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}
48unsafe impl SqlTranslatable for crate::FdwRoutine {
49    fn argument_sql() -> Result<SqlMapping, ArgumentError> {
50        Ok(SqlMapping::literal("fdw_handler"))
51    }
52    fn return_sql() -> Result<Returns, ReturnsError> {
53        Ok(Returns::One(SqlMapping::literal("fdw_handler")))
54    }
55}
56
57unsafe impl SqlTranslatable for crate::BOX {
58    fn argument_sql() -> Result<SqlMapping, ArgumentError> {
59        Ok(SqlMapping::literal("box"))
60    }
61    fn return_sql() -> Result<Returns, ReturnsError> {
62        Ok(Returns::One(SqlMapping::literal("box")))
63    }
64}
65
66unsafe impl SqlTranslatable for crate::Point {
67    fn argument_sql() -> Result<SqlMapping, ArgumentError> {
68        Ok(SqlMapping::literal("point"))
69    }
70    fn return_sql() -> Result<Returns, ReturnsError> {
71        Ok(Returns::One(SqlMapping::literal("point")))
72    }
73}
74
75unsafe impl SqlTranslatable for crate::ItemPointerData {
76    fn argument_sql() -> Result<SqlMapping, ArgumentError> {
77        Ok(SqlMapping::literal("tid"))
78    }
79    fn return_sql() -> Result<Returns, ReturnsError> {
80        Ok(Returns::One(SqlMapping::literal("tid")))
81    }
82}
83
84unsafe impl SqlTranslatable for crate::Datum {
85    fn argument_sql() -> Result<SqlMapping, ArgumentError> {
86        Err(ArgumentError::Datum)
87    }
88    fn return_sql() -> Result<Returns, ReturnsError> {
89        Err(ReturnsError::Datum)
90    }
91}