pgrx_pg_sys/submodules/
sql_translatable.rs

1//LICENSE Portions Copyright 2019-2021 ZomboDB, LLC.
2//LICENSE
3//LICENSE Portions Copyright 2021-2023 Technology Concepts & Design, Inc.
4//LICENSE
5//LICENSE Portions Copyright 2023-2023 PgCentral Foundation, Inc. <contact@pgcentral.org>
6//LICENSE
7//LICENSE All rights reserved.
8//LICENSE
9//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
10use pgrx_sql_entity_graph::metadata::{
11    ArgumentError, Returns, ReturnsError, SqlMapping, SqlTranslatable,
12};
13
14#[cfg(any(
15    feature = "pg17",
16    feature = "pg16",
17    feature = "pg15",
18    feature = "pg14",
19    feature = "pg13",
20    feature = "pg12"
21))]
22unsafe impl SqlTranslatable for crate::FunctionCallInfoBaseData {
23    fn argument_sql() -> Result<SqlMapping, ArgumentError> {
24        Ok(SqlMapping::Skip)
25    }
26    fn return_sql() -> Result<Returns, ReturnsError> {
27        Ok(Returns::One(SqlMapping::Skip))
28    }
29}
30
31unsafe impl SqlTranslatable for crate::PlannerInfo {
32    fn argument_sql() -> Result<SqlMapping, ArgumentError> {
33        Ok(SqlMapping::literal("internal"))
34    }
35    fn return_sql() -> Result<Returns, ReturnsError> {
36        Ok(Returns::One(SqlMapping::literal("internal")))
37    }
38}
39
40unsafe impl SqlTranslatable for crate::IndexAmRoutine {
41    fn argument_sql() -> Result<SqlMapping, ArgumentError> {
42        Ok(SqlMapping::literal("internal"))
43    }
44    fn return_sql() -> Result<Returns, ReturnsError> {
45        Ok(Returns::One(SqlMapping::literal("internal")))
46    }
47}
48
49unsafe impl SqlTranslatable for crate::TableAmRoutine {
50    fn argument_sql() -> Result<SqlMapping, ArgumentError> {
51        Ok(SqlMapping::literal("internal"))
52    }
53    fn return_sql() -> Result<Returns, ReturnsError> {
54        Ok(Returns::One(SqlMapping::literal("internal")))
55    }
56}
57
58unsafe impl SqlTranslatable for crate::FdwRoutine {
59    fn argument_sql() -> Result<SqlMapping, ArgumentError> {
60        Ok(SqlMapping::literal("fdw_handler"))
61    }
62    fn return_sql() -> Result<Returns, ReturnsError> {
63        Ok(Returns::One(SqlMapping::literal("fdw_handler")))
64    }
65}
66
67unsafe impl SqlTranslatable for crate::BOX {
68    fn argument_sql() -> Result<SqlMapping, ArgumentError> {
69        Ok(SqlMapping::literal("box"))
70    }
71    fn return_sql() -> Result<Returns, ReturnsError> {
72        Ok(Returns::One(SqlMapping::literal("box")))
73    }
74}
75
76unsafe impl SqlTranslatable for crate::Point {
77    fn argument_sql() -> Result<SqlMapping, ArgumentError> {
78        Ok(SqlMapping::literal("point"))
79    }
80    fn return_sql() -> Result<Returns, ReturnsError> {
81        Ok(Returns::One(SqlMapping::literal("point")))
82    }
83}
84
85unsafe impl SqlTranslatable for crate::ItemPointerData {
86    fn argument_sql() -> Result<SqlMapping, ArgumentError> {
87        Ok(SqlMapping::literal("tid"))
88    }
89    fn return_sql() -> Result<Returns, ReturnsError> {
90        Ok(Returns::One(SqlMapping::literal("tid")))
91    }
92}
93
94unsafe impl SqlTranslatable for crate::Datum {
95    fn argument_sql() -> Result<SqlMapping, ArgumentError> {
96        Err(ArgumentError::Datum)
97    }
98    fn return_sql() -> Result<Returns, ReturnsError> {
99        Err(ReturnsError::Datum)
100    }
101}