13
13
#include < cstdint>
14
14
15
15
#include " nodes.h"
16
- #include " parser/ pg_list.h"
16
+ #include " pg_list.h"
17
17
18
18
typedef enum SetOperation {
19
19
SETOP_NONE = 0 ,
@@ -44,14 +44,14 @@ typedef struct Expr { NodeTag type; } Expr;
44
44
* A SubLink represents a subselect appearing in an expression, and in some
45
45
* cases also the combining operator(s) just above it. The subLinkType
46
46
* indicates the form of the expression represented:
47
- * EXISTS_SUBLINK EXISTS(SELECT ...)
48
- * ALL_SUBLINK (lefthand) op ALL (SELECT ...)
49
- * ANY_SUBLINK (lefthand) op ANY (SELECT ...)
50
- * ROWCOMPARE_SUBLINK (lefthand) op (SELECT ...)
51
- * EXPR_SUBLINK (SELECT with single targetlist item ...)
52
- * MULTIEXPR_SUBLINK (SELECT with multiple targetlist items ...)
53
- * ARRAY_SUBLINK ARRAY(SELECT with single targetlist item ...)
54
- * CTE_SUBLINK WITH query (never actually part of an expression)
47
+ * EXISTS_SUBLINK EXISTS(SELECT ...)
48
+ * ALL_SUBLINK (lefthand) op ALL (SELECT ...)
49
+ * ANY_SUBLINK (lefthand) op ANY (SELECT ...)
50
+ * ROWCOMPARE_SUBLINK (lefthand) op (SELECT ...)
51
+ * EXPR_SUBLINK (SELECT with single targetlist item ...)
52
+ * MULTIEXPR_SUBLINK (SELECT with multiple targetlist items ...)
53
+ * ARRAY_SUBLINK ARRAY(SELECT with single targetlist item ...)
54
+ * CTE_SUBLINK WITH query (never actually part of an expression)
55
55
* For ALL, ANY, and ROWCOMPARE, the lefthand is a list of expressions of the
56
56
* same length as the subselect's targetlist. ROWCOMPARE will *always* have
57
57
* a list with more than one entry; if the subselect has just one target
@@ -73,8 +73,7 @@ typedef struct Expr { NodeTag type; } Expr;
73
73
* of the lefthand expression (if any), and operName is the String name of
74
74
* the combining operator. Also, subselect is a raw parsetree. During parse
75
75
* analysis, the parser transforms testexpr into a complete boolean expression
76
- * that compares the lefthand value(s) to PARAM_SUBLINK nodes representing
77
- *the
76
+ * that compares the lefthand value(s) to PARAM_SUBLINK nodes representing the
78
77
* output columns of the subselect. And subselect is transformed to a Query.
79
78
* This is the representation seen in saved rules and in the rewriter.
80
79
*
@@ -90,25 +89,28 @@ typedef struct Expr { NodeTag type; } Expr;
90
89
* The CTE_SUBLINK case never occurs in actual SubLink nodes, but it is used
91
90
* in SubPlans generated for WITH subqueries.
92
91
*/
93
- typedef enum SubLinkType {
92
+ typedef enum SubLinkType
93
+ {
94
94
EXISTS_SUBLINK,
95
95
ALL_SUBLINK,
96
96
ANY_SUBLINK,
97
97
ROWCOMPARE_SUBLINK,
98
98
EXPR_SUBLINK,
99
99
MULTIEXPR_SUBLINK,
100
100
ARRAY_SUBLINK,
101
- CTE_SUBLINK /* for SubPlans only */
101
+ CTE_SUBLINK /* for SubPlans only */
102
102
} SubLinkType;
103
103
104
- typedef struct SubLink {
105
- Expr xpr;
106
- SubLinkType subLinkType; /* see above */
107
- int subLinkId; /* ID (1..n); 0 if not MULTIEXPR */
108
- Node *testexpr; /* outer-query test for ALL/ANY/ROWCOMPARE */
109
- List *operName; /* originally specified operator name */
110
- Node *subselect; /* subselect as Query* or raw parsetree */
111
- int location; /* token location, or -1 if unknown */
104
+
105
+ typedef struct SubLink
106
+ {
107
+ Expr xpr;
108
+ SubLinkType subLinkType; /* see above */
109
+ int subLinkId; /* ID (1..n); 0 if not MULTIEXPR */
110
+ Node *testexpr; /* outer-query test for ALL/ANY/ROWCOMPARE */
111
+ List *operName; /* originally specified operator name */
112
+ Node *subselect; /* subselect as Query* or raw parsetree */
113
+ int location; /* token location, or -1 if unknown */
112
114
} SubLink;
113
115
114
116
typedef struct BoolExpr {
@@ -648,8 +650,8 @@ typedef struct DropStmt {
648
650
649
651
typedef struct DropDatabaseStmt {
650
652
NodeTag type;
651
- char *dbname; /* name of database to drop */
652
- bool missing_ok; /* skip error if object is missing? */
653
+ char *dbname; /* name of database to drop */
654
+ bool missing_ok; /* skip error if object is missing? */
653
655
} DropDatabaseStmt;
654
656
655
657
typedef struct TruncateStmt {
@@ -706,42 +708,47 @@ typedef struct CreateDatabaseStmt {
706
708
List *options; /* List of DefElem nodes */
707
709
} CreateDatabaseStmt;
708
710
709
- typedef struct CreateSchemaStmt {
710
- NodeTag type;
711
- char *schemaname; /* the name of the schema to create */
712
- Node *authrole; /* the owner of the created schema */
713
- List *schemaElts; /* schema components (list of parsenodes) */
714
- bool if_not_exists; /* just do nothing if schema already exists? */
711
+ typedef struct CreateSchemaStmt
712
+ {
713
+ NodeTag type;
714
+ char *schemaname; /* the name of the schema to create */
715
+ Node *authrole; /* the owner of the created schema */
716
+ List *schemaElts; /* schema components (list of parsenodes) */
717
+ bool if_not_exists; /* just do nothing if schema already exists? */
715
718
} CreateSchemaStmt;
716
719
717
- typedef enum RoleSpecType {
718
- ROLESPEC_CSTRING, /* role name is stored as a C string */
719
- ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */
720
- ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */
721
- ROLESPEC_PUBLIC /* role name is "public" */
720
+ typedef enum RoleSpecType
721
+ {
722
+ ROLESPEC_CSTRING, /* role name is stored as a C string */
723
+ ROLESPEC_CURRENT_USER, /* role spec is CURRENT_USER */
724
+ ROLESPEC_SESSION_USER, /* role spec is SESSION_USER */
725
+ ROLESPEC_PUBLIC /* role name is "public" */
722
726
} RoleSpecType;
723
727
724
- typedef struct RoleSpec {
725
- NodeTag type;
726
- RoleSpecType roletype; /* Type of this rolespec */
727
- char *rolename; /* filled only for ROLESPEC_CSTRING */
728
- int location; /* token location, or -1 if unknown */
728
+ typedef struct RoleSpec
729
+ {
730
+ NodeTag type;
731
+ RoleSpecType roletype; /* Type of this rolespec */
732
+ char *rolename; /* filled only for ROLESPEC_CSTRING */
733
+ int location; /* token location, or -1 if unknown */
729
734
} RoleSpec;
730
735
731
- typedef enum ViewCheckOption {
736
+ typedef enum ViewCheckOption
737
+ {
732
738
NO_CHECK_OPTION,
733
739
LOCAL_CHECK_OPTION,
734
740
CASCADED_CHECK_OPTION
735
741
} ViewCheckOption;
736
742
737
- typedef struct ViewStmt {
738
- NodeTag type;
739
- RangeVar *view; /* the view to be created */
740
- List *aliases; /* target column names */
741
- Node *query; /* the SELECT query */
742
- bool replace; /* replace an existing view? */
743
- List *options; /* options from WITH clause */
744
- ViewCheckOption withCheckOption; /* WITH CHECK OPTION */
743
+ typedef struct ViewStmt
744
+ {
745
+ NodeTag type;
746
+ RangeVar *view; /* the view to be created */
747
+ List *aliases; /* target column names */
748
+ Node *query; /* the SELECT query */
749
+ bool replace; /* replace an existing view? */
750
+ List *options; /* options from WITH clause */
751
+ ViewCheckOption withCheckOption; /* WITH CHECK OPTION */
745
752
} ViewStmt;
746
753
747
754
typedef struct ParamRef {
@@ -767,26 +774,29 @@ typedef struct VacuumStmt {
767
774
List *va_cols; /* list of column names, or NIL for all */
768
775
} VacuumStmt;
769
776
770
- typedef enum {
771
- VAR_SET_VALUE, /* SET var = value */
772
- VAR_SET_DEFAULT, /* SET var TO DEFAULT */
773
- VAR_SET_CURRENT, /* SET var FROM CURRENT */
774
- VAR_SET_MULTI, /* special case for SET TRANSACTION ... */
775
- VAR_RESET, /* RESET var */
776
- VAR_RESET_ALL /* RESET ALL */
777
+ typedef enum
778
+ {
779
+ VAR_SET_VALUE, /* SET var = value */
780
+ VAR_SET_DEFAULT, /* SET var TO DEFAULT */
781
+ VAR_SET_CURRENT, /* SET var FROM CURRENT */
782
+ VAR_SET_MULTI, /* special case for SET TRANSACTION ... */
783
+ VAR_RESET, /* RESET var */
784
+ VAR_RESET_ALL /* RESET ALL */
777
785
} VariableSetKind;
778
786
779
- typedef struct VariableSetStmt {
780
- NodeTag type;
787
+ typedef struct VariableSetStmt
788
+ {
789
+ NodeTag type;
781
790
VariableSetKind kind;
782
- char *name; /* variable to be set */
783
- List *args; /* List of A_Const nodes */
784
- bool is_local; /* SET LOCAL? */
791
+ char *name; /* variable to be set */
792
+ List *args; /* List of A_Const nodes */
793
+ bool is_local; /* SET LOCAL? */
785
794
} VariableSetStmt;
786
795
787
- typedef struct VariableShowStmt {
788
- NodeTag type;
789
- char *name;
796
+ typedef struct VariableShowStmt
797
+ {
798
+ NodeTag type;
799
+ char *name;
790
800
} VariableShowStmt;
791
801
792
802
// / ********** For UDFs *********** ///
0 commit comments