MCPcopy Create free account
hub / github.com/apache/cloudberry / checkWellFormedSelectStmt

Function checkWellFormedSelectStmt

src/backend/parser/parse_cte.c:1150–1214  ·  view source on GitHub ↗

* subroutine for checkWellFormedRecursionWalker: process a SelectStmt * without worrying about its WITH clause */

Source from the content-addressed store, hash-verified

1148 * without worrying about its WITH clause
1149 */
1150static void
1151checkWellFormedSelectStmt(SelectStmt *stmt, CteState *cstate)
1152{
1153 RecursionContext save_context = cstate->context;
1154
1155 if (save_context != RECURSION_OK)
1156 {
1157 /* just recurse without changing state */
1158 raw_expression_tree_walker((Node *) stmt,
1159 checkWellFormedRecursionWalker,
1160 (void *) cstate);
1161 }
1162 else
1163 {
1164 switch (stmt->op)
1165 {
1166 case SETOP_NONE:
1167 case SETOP_UNION:
1168 raw_expression_tree_walker((Node *) stmt,
1169 checkWellFormedRecursionWalker,
1170 (void *) cstate);
1171 break;
1172 case SETOP_INTERSECT:
1173 if (stmt->all)
1174 cstate->context = RECURSION_INTERSECT;
1175 checkWellFormedRecursionWalker((Node *) stmt->larg,
1176 cstate);
1177 checkWellFormedRecursionWalker((Node *) stmt->rarg,
1178 cstate);
1179 cstate->context = save_context;
1180 checkWellFormedRecursionWalker((Node *) stmt->sortClause,
1181 cstate);
1182 checkWellFormedRecursionWalker((Node *) stmt->limitOffset,
1183 cstate);
1184 checkWellFormedRecursionWalker((Node *) stmt->limitCount,
1185 cstate);
1186 checkWellFormedRecursionWalker((Node *) stmt->lockingClause,
1187 cstate);
1188 /* stmt->withClause is intentionally ignored here */
1189 break;
1190 case SETOP_EXCEPT:
1191 if (stmt->all)
1192 cstate->context = RECURSION_EXCEPT;
1193 checkWellFormedRecursionWalker((Node *) stmt->larg,
1194 cstate);
1195 cstate->context = RECURSION_EXCEPT;
1196 checkWellFormedRecursionWalker((Node *) stmt->rarg,
1197 cstate);
1198 cstate->context = save_context;
1199 checkWellFormedRecursionWalker((Node *) stmt->sortClause,
1200 cstate);
1201 checkWellFormedRecursionWalker((Node *) stmt->limitOffset,
1202 cstate);
1203 checkWellFormedRecursionWalker((Node *) stmt->limitCount,
1204 cstate);
1205 checkWellFormedRecursionWalker((Node *) stmt->lockingClause,
1206 cstate);
1207 /* stmt->withClause is intentionally ignored here */

Callers 2

Calls 2

Tested by

no test coverage detected