/Users/deen/code/yugabyte-db/src/yb/yql/cql/ql/parser/parser_inactive_nodes.h
Line | Count | Source (jump to first uncovered line) |
1 | | //-------------------------------------------------------------------------------------------------- |
2 | | // The following only applies to changes made to this file as part of YugaByte development. |
3 | | // |
4 | | // Copyright (c) YugaByte, Inc. |
5 | | // |
6 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
7 | | // in compliance with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
12 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
13 | | // or implied. See the License for the specific language governing permissions and limitations |
14 | | // under the License. |
15 | | // |
16 | | // Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group |
17 | | // Portions Copyright (c) 1994, Regents of the University of California |
18 | | // |
19 | | // parser_inactive_nodes.h |
20 | | // Definitions for parse tree nodes that are not used. A lof of PostgreQL features are not |
21 | | // supported by Yugabyte, so there are unused node types. |
22 | | // |
23 | | // Many of the node types used in parsetrees include a "location" field. This is a byte (not |
24 | | // character) offset in the original source text, to be used for positioning an error cursor when |
25 | | // there is an error related to the node. Access to the original source text is needed to make use |
26 | | // of the location. |
27 | | //-------------------------------------------------------------------------------------------------- |
28 | | |
29 | | #ifndef YB_YQL_CQL_QL_PARSER_PARSER_INACTIVE_NODES_H_ |
30 | | #define YB_YQL_CQL_QL_PARSER_PARSER_INACTIVE_NODES_H_ |
31 | | |
32 | | #include <limits.h> |
33 | | |
34 | | namespace yb { |
35 | | namespace ql { |
36 | | |
37 | | class UndefTreeNode : public TreeNode { |
38 | | public: |
39 | | //------------------------------------------------------------------------------------------------ |
40 | | // Public types. |
41 | | typedef MCSharedPtr<UndefTreeNode> SharedPtr; |
42 | | typedef MCSharedPtr<const UndefTreeNode> SharedPtrConst; |
43 | | |
44 | | //------------------------------------------------------------------------------------------------ |
45 | | // Public functions. |
46 | 0 | UndefTreeNode() {} |
47 | 0 | ~UndefTreeNode() {} |
48 | | |
49 | | // Node type. |
50 | 0 | virtual TreeNodeOpcode opcode() const override { |
51 | 0 | return TreeNodeOpcode::kNoOp; |
52 | 0 | } |
53 | | }; |
54 | | |
55 | | //------------------------------------------------------------------------------------------------ |
56 | | // NOTE: All entities below this line in this modules are copies of PostgreQL's code. We made |
57 | | // some minor changes to avoid lint errors such as using '{' for if blocks, change the comment |
58 | | // style from '/**/' to '//', and post-fix data members with "_". |
59 | | // |
60 | | // The following PostgreSQL C-sytle structures are kept here for compilation purpose. They are used |
61 | | // for SQL features that are unsupported by QL. When these features are supported, we'll |
62 | | // redefined these types with C++ structures. |
63 | | //-------------------------------------------------------------------------------------------------- |
64 | | |
65 | | // JoinType - |
66 | | // enums for types of relation joins |
67 | | // |
68 | | // JoinType determines the exact semantics of joining two relations using |
69 | | // a matching qualification. For example, it tells what to do with a tuple |
70 | | // that has no match in the other relation. |
71 | | // |
72 | | // This is needed in both parsenodes.h and plannodes.h, so put it here... |
73 | | typedef enum JoinType : int { |
74 | | // The canonical kinds of joins according to the SQL JOIN syntax. Only |
75 | | // these codes can appear in parser output (e.g., JoinExpr nodes). |
76 | | JOIN_INNER, /* matching tuple pairs only */ |
77 | | JOIN_LEFT, /* pairs + unmatched LHS tuples */ |
78 | | JOIN_FULL, /* pairs + unmatched LHS + unmatched RHS */ |
79 | | JOIN_RIGHT, /* pairs + unmatched RHS tuples */ |
80 | | |
81 | | // Semijoins and anti-semijoins (as defined in relational theory) do not |
82 | | // appear in the SQL JOIN syntax, but there are standard idioms for |
83 | | // representing them (e.g., using EXISTS). The planner recognizes these |
84 | | // cases and converts them to joins. So the planner and executor must |
85 | | // support these codes. NOTE: in JOIN_SEMI output, it is unspecified |
86 | | // which matching RHS row is joined to. In JOIN_ANTI output, the row is |
87 | | // guaranteed to be null-extended. |
88 | | JOIN_SEMI, /* 1 copy of each LHS row that has match(es) */ |
89 | | JOIN_ANTI, /* 1 copy of each LHS row that has no match */ |
90 | | |
91 | | // These codes are used internally in the planner, but are not supported |
92 | | // by the executor (nor, indeed, by most of the planner). |
93 | | JOIN_UNIQUE_OUTER, /* LHS path must be made unique */ |
94 | | JOIN_UNIQUE_INNER /* RHS path must be made unique */ |
95 | | |
96 | | // We might need additional join types someday. |
97 | | } JoinType; |
98 | | |
99 | | typedef enum FunctionParameterMode : int { |
100 | | // the assigned enum values appear in pg_proc, don't change 'em!. |
101 | | FUNC_PARAM_IN = 'i', /* input only */ |
102 | | FUNC_PARAM_OUT = 'o', /* output only */ |
103 | | FUNC_PARAM_INOUT = 'b', /* both */ |
104 | | FUNC_PARAM_VARIADIC = 'v', /* variadic (always input) */ |
105 | | FUNC_PARAM_TABLE = 't' /* table function output column */ |
106 | | } FunctionParameterMode; |
107 | | |
108 | | // What to do at commit time for temporary relations. |
109 | | typedef enum OnCommitAction : int { |
110 | | ONCOMMIT_NOOP, /* No ON COMMIT clause (do nothing) */ |
111 | | ONCOMMIT_PRESERVE_ROWS, /* ON COMMIT PRESERVE ROWS (do nothing) */ |
112 | | ONCOMMIT_DELETE_ROWS, /* ON COMMIT DELETE ROWS */ |
113 | | ONCOMMIT_DROP /* ON COMMIT DROP */ |
114 | | } OnCommitAction; |
115 | | |
116 | | // TableLikeClause - CREATE TABLE ( ... LIKE ... ) clause |
117 | | typedef enum TableLikeOption : int { |
118 | | CREATE_TABLE_LIKE_DEFAULTS = 1 << 0, |
119 | | CREATE_TABLE_LIKE_CONSTRAINTS = 1 << 1, |
120 | | CREATE_TABLE_LIKE_INDEXES = 1 << 2, |
121 | | CREATE_TABLE_LIKE_STORAGE = 1 << 3, |
122 | | CREATE_TABLE_LIKE_COMMENTS = 1 << 4, |
123 | | CREATE_TABLE_LIKE_ALL = INT_MAX |
124 | | } TableLikeOption; |
125 | | |
126 | | // Foreign key action codes. |
127 | | #define FKCONSTR_ACTION_NOACTION 'a' |
128 | | #define FKCONSTR_ACTION_RESTRICT 'r' |
129 | | #define FKCONSTR_ACTION_CASCADE 'c' |
130 | | #define FKCONSTR_ACTION_SETNULL 'n' |
131 | | #define FKCONSTR_ACTION_SETDEFAULT 'd' |
132 | | |
133 | | // Foreign key matchtype codes. |
134 | | #define FKCONSTR_MATCH_FULL 'f' |
135 | | #define FKCONSTR_MATCH_PARTIAL 'p' |
136 | | #define FKCONSTR_MATCH_SIMPLE 's' |
137 | | |
138 | | typedef enum GrantObjectType : int { |
139 | | ACL_OBJECT_COLUMN, /* column */ |
140 | | ACL_OBJECT_RELATION, /* table, view */ |
141 | | ACL_OBJECT_SEQUENCE, /* sequence */ |
142 | | ACL_OBJECT_DATABASE, /* database */ |
143 | | ACL_OBJECT_DOMAIN, /* domain */ |
144 | | ACL_OBJECT_FDW, /* foreign-data wrapper */ |
145 | | ACL_OBJECT_FOREIGN_SERVER, /* foreign server */ |
146 | | ACL_OBJECT_FUNCTION, /* function */ |
147 | | ACL_OBJECT_LANGUAGE, /* procedural language */ |
148 | | ACL_OBJECT_LARGEOBJECT, /* largeobject */ |
149 | | ACL_OBJECT_NAMESPACE, /* namespace */ |
150 | | ACL_OBJECT_TABLESPACE, /* tablespace */ |
151 | | ACL_OBJECT_TYPE /* type */ |
152 | | } GrantObjectType; |
153 | | |
154 | | /* Sort ordering options for ORDER BY and CREATE INDEX */ |
155 | | typedef enum SortByDir : int { |
156 | | SORTBY_DEFAULT, |
157 | | SORTBY_ASC, |
158 | | SORTBY_DESC, |
159 | | SORTBY_USING /* not allowed in CREATE INDEX ... */ |
160 | | } SortByDir; |
161 | | |
162 | | typedef enum SortByNulls : int { |
163 | | SORTBY_NULLS_DEFAULT, |
164 | | SORTBY_NULLS_FIRST, |
165 | | SORTBY_NULLS_LAST |
166 | | } SortByNulls; |
167 | | |
168 | | // Reindex options. |
169 | 0 | #define REINDEXOPT_VERBOSE 1 << 0 /* print progress info */ |
170 | | |
171 | | typedef enum ReindexObjectType : int { |
172 | | REINDEX_OBJECT_INDEX, /* index */ |
173 | | REINDEX_OBJECT_TABLE, /* table or materialized view */ |
174 | | REINDEX_OBJECT_SCHEMA, /* schema */ |
175 | | REINDEX_OBJECT_SYSTEM, /* system catalogs */ |
176 | | REINDEX_OBJECT_DATABASE /* database */ |
177 | | } ReindexObjectType; |
178 | | |
179 | | // CmdType - |
180 | | // enums for type of operation represented by a Query or PlannedStmt |
181 | | // |
182 | | // This is needed in both parsenodes.h and plannodes.h, so put it here... |
183 | | typedef enum CmdType : int { |
184 | | CMD_UNKNOWN, |
185 | | CMD_SELECT, /* select stmt */ |
186 | | CMD_UPDATE, /* update stmt */ |
187 | | CMD_INSERT, /* insert stmt */ |
188 | | CMD_DELETE, |
189 | | CMD_UTILITY, /* cmds like create, destroy, copy, vacuum, etc. */ |
190 | | CMD_NOTHING /* dummy command for instead nothing rules with qual */ |
191 | | } CmdType; |
192 | | |
193 | | // Create View Statement |
194 | | typedef enum ViewCheckOption : int { |
195 | | NO_CHECK_OPTION, |
196 | | LOCAL_CHECK_OPTION, |
197 | | CASCADED_CHECK_OPTION |
198 | | } ViewCheckOption; |
199 | | |
200 | | // Vacuum and Analyze Statements |
201 | | // |
202 | | // Even though these are nominally two statements, it's convenient to use |
203 | | // just one node type for both. Note that at least one of VACOPT_VACUUM |
204 | | // and VACOPT_ANALYZE must be set in options. |
205 | | typedef enum VacuumOption : int { |
206 | | VACOPT_VACUUM = 1 << 0, /* do VACUUM */ |
207 | | VACOPT_ANALYZE = 1 << 1, /* do ANALYZE */ |
208 | | VACOPT_VERBOSE = 1 << 2, /* print progress info */ |
209 | | VACOPT_FREEZE = 1 << 3, /* FREEZE option */ |
210 | | VACOPT_FULL = 1 << 4, /* FULL (non-concurrent) vacuum */ |
211 | | VACOPT_NOWAIT = 1 << 5, /* don't wait to get lock (autovacuum only) */ |
212 | | VACOPT_SKIPTOAST = 1 << 6 /* don't process the TOAST table, if any */ |
213 | | } VacuumOption; |
214 | | |
215 | | // Declare Cursor Statement |
216 | | // |
217 | | // Note: the "query" field of DeclareCursorStmt is only used in the raw grammar |
218 | | // output. After parse analysis it's set to null, and the Query points to the |
219 | | // DeclareCursorStmt, not vice versa. |
220 | 0 | #define CURSOR_OPT_BINARY 0x0001 /* BINARY */ |
221 | 0 | #define CURSOR_OPT_SCROLL 0x0002 /* SCROLL explicitly given */ |
222 | 0 | #define CURSOR_OPT_NO_SCROLL 0x0004 /* NO SCROLL explicitly given */ |
223 | 0 | #define CURSOR_OPT_INSENSITIVE 0x0008 /* INSENSITIVE */ |
224 | 0 | #define CURSOR_OPT_HOLD 0x0010 /* WITH HOLD */ |
225 | | /* these planner-control flags do not correspond to any SQL grammar: */ |
226 | | #define CURSOR_OPT_FAST_PLAN 0x0020 /* prefer fast-start plan */ |
227 | | #define CURSOR_OPT_GENERIC_PLAN 0x0040 /* force use of generic plan */ |
228 | | #define CURSOR_OPT_CUSTOM_PLAN 0x0080 /* force use of custom plan */ |
229 | | |
230 | | // Import Foreign Schema Statement |
231 | | typedef enum ImportForeignSchemaType : int { |
232 | | FDW_IMPORT_SCHEMA_ALL, /* all relations wanted */ |
233 | | FDW_IMPORT_SCHEMA_LIMIT_TO, /* include only listed tables in import */ |
234 | | FDW_IMPORT_SCHEMA_EXCEPT /* exclude listed tables from import */ |
235 | | } ImportForeignSchemaType; |
236 | | |
237 | | } // namespace ql |
238 | | } // namespace yb |
239 | | |
240 | | #endif // YB_YQL_CQL_QL_PARSER_PARSER_INACTIVE_NODES_H_ |