81 bool isTopLevel,
List **targetlist);
100#ifdef DEBUG_NODE_TESTS_ENABLED
101static bool test_raw_expression_coverage(
Node *node,
void *context);
118 const Oid *paramTypes,
int numParams,
125 Assert(sourceText != NULL);
140 (*post_parse_analyze_hook) (pstate, query, jstate);
158 Oid **paramTypes,
int *numParams,
165 Assert(sourceText != NULL);
182 (*post_parse_analyze_hook) (pstate, query, jstate);
200 void *parserSetupArg,
207 Assert(sourceText != NULL);
211 (*parserSetup) (pstate, parserSetupArg);
219 (*post_parse_analyze_hook) (pstate, query, jstate);
236 bool locked_from_parent,
237 bool resolve_unknowns)
269 result->stmt_len = parseTree->
stmt_len;
296 if (
stmt->intoClause)
300 ctas->
query = parseTree;
310 stmt->intoClause = NULL;
312 parseTree = (
Node *) ctas;
328#ifdef DEBUG_NODE_TESTS_ENABLED
336 if (Debug_raw_expression_coverage_test)
345 (void) test_raw_expression_coverage(parseTree, NULL);
404 case T_DeclareCursorStmt:
414 case T_CreateTableAsStmt:
438 result->canSetTag =
true;
481 case T_DeclareCursorStmt:
483 case T_CreateTableAsStmt:
546 case T_DeclareCursorStmt:
548 case T_CreateTableAsStmt:
574 if (
stmt->withClause)
576 qry->hasRecursive =
stmt->withClause->recursive;
642 bool isGeneralSelect;
644 List *sub_rteperminfos;
653 bool isOnConflictUpdate;
663 if (
stmt->withClause)
665 qry->hasRecursive =
stmt->withClause->recursive;
670 qry->override =
stmt->override;
672 isOnConflictUpdate = (
stmt->onConflictClause &&
684 isGeneralSelect = (selectStmt && (selectStmt->
valuesLists ==
NIL ||
712 sub_rteperminfos =
NIL;
723 if (isOnConflictUpdate)
726 false,
false, targetPerms);
735 if (selectStmt == NULL)
744 else if (isGeneralSelect)
784 elog(
ERROR,
"unexpected non-SELECT command in INSERT ... SELECT");
830 exprList =
lappend(exprList, expr);
851 int sublist_length = -1;
852 bool lateral =
false;
854 Assert(selectStmt->intoClause == NULL);
856 foreach(lc, selectStmt->valuesLists)
872 if (sublist_length < 0)
880 (
errcode(ERRCODE_SYNTAX_ERROR),
881 errmsg(
"VALUES lists must all be the same length"),
915 exprsLists =
lappend(exprsLists, sublist);
948 coltypes, coltypmods, colcollations,
949 NULL, lateral,
true);
973 List *valuesLists = selectStmt->valuesLists;
976 Assert(selectStmt->intoClause == NULL);
998 perminfo = pstate->p_target_nsitem->p_perminfo;
999 qry->targetList =
NIL;
1001 forthree(lc, exprList, icols, icolumns, attnos, attrnos)
1012 qry->targetList =
lappend(qry->targetList, tle);
1023 if (
stmt->onConflictClause ||
stmt->returningClause)
1025 pstate->p_namespace =
NIL;
1031 if (
stmt->onConflictClause)
1033 stmt->onConflictClause);
1036 if (
stmt->returningClause)
1041 qry->rtable = pstate->p_rtable;
1042 qry->rteperminfos = pstate->p_rteperminfos;
1043 qry->jointree =
makeFromExpr(pstate->p_joinlist, NULL);
1045 qry->hasTargetSRFs = pstate->p_hasTargetSRFs;
1046 qry->hasSubLinks = pstate->p_hasSubLinks;
1066 bool strip_indirection)
1082 (
errcode(ERRCODE_SYNTAX_ERROR),
1083 errmsg(
"INSERT has more expressions than target columns"),
1087 if (stmtcols !=
NIL &&
1100 (
errcode(ERRCODE_SYNTAX_ERROR),
1101 errmsg(
"INSERT has more target columns than expressions"),
1105 errhint(
"The insertion source is a row expression containing the same number of columns expected by the INSERT. Did you accidentally use extra parentheses?") : 0),
1115 forthree(lc, exprlist, icols, icolumns, attnos, attrnos)
1128 if (strip_indirection)
1137 Expr *subexpr = expr;
1163 result =
lappend(result, expr);
1180 Oid arbiterConstraint;
1182 Node *onConflictWhere = NULL;
1183 int exclRelIndex = 0;
1203 exclRte = exclNSItem->
p_rte;
1211 exclRte->relkind = RELKIND_COMPOSITE_TYPE;
1220 &arbiterWhere, &arbiterConstraint);
1298 if (attr->attisdropped)
1309 var =
makeVar(exclRelIndex, attno + 1,
1310 attr->atttypid, attr->atttypmod,
1332 targetrel->
rd_rel->reltype,
1362 if (
attnum > 0 && var->vartype == RECORDOID)
1373 if (ste == NULL || ste->resjunk)
1410 if (
stmt->withClause)
1412 qry->hasRecursive =
stmt->withClause->recursive;
1418 if (
stmt->intoClause)
1420 (
errcode(ERRCODE_SYNTAX_ERROR),
1421 errmsg(
"SELECT ... INTO is not allowed here"),
1480 if (
stmt->distinctClause ==
NIL)
1483 qry->hasDistinctOn =
false;
1492 qry->hasDistinctOn =
false;
1498 stmt->distinctClause,
1501 qry->hasDistinctOn =
true;
1531 foreach(l,
stmt->lockingClause)
1561 List **colexprs = NULL;
1562 int sublist_length = -1;
1563 bool lateral =
false;
1583 if (
stmt->withClause)
1585 qry->hasRecursive =
stmt->withClause->recursive;
1597 foreach(lc,
stmt->valuesLists)
1613 if (sublist_length < 0)
1623 (
errcode(ERRCODE_SYNTAX_ERROR),
1624 errmsg(
"VALUES lists must all be the same length"),
1631 foreach(lc2, sublist)
1635 colexprs[
i] =
lappend(colexprs[
i], col);
1660 for (
i = 0;
i < sublist_length;
i++)
1668 foreach(lc, colexprs[
i])
1681 colcollations =
lappend_oid(colcollations, colcoll);
1687 for (
i = 0;
i < sublist_length;
i++)
1689 forboth(lc, colexprs[
i], lc2, exprsLists)
1694 sublist =
lappend(sublist, col);
1714 coltypes, coltypmods, colcollations,
1715 NULL, lateral,
true);
1742 if (
stmt->lockingClause)
1744 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1747 errmsg(
"%s cannot be applied to VALUES",
1778 Query *leftmostQuery;
1783 List *lockingClause;
1794 int sv_rtable_length;
1810 leftmostSelect =
stmt->larg;
1811 while (leftmostSelect && leftmostSelect->
op !=
SETOP_NONE)
1812 leftmostSelect = leftmostSelect->
larg;
1814 leftmostSelect->
larg == NULL);
1817 (
errcode(ERRCODE_SYNTAX_ERROR),
1818 errmsg(
"SELECT ... INTO is not allowed here"),
1827 sortClause =
stmt->sortClause;
1828 limitOffset =
stmt->limitOffset;
1829 limitCount =
stmt->limitCount;
1830 lockingClause =
stmt->lockingClause;
1831 withClause =
stmt->withClause;
1834 stmt->limitOffset = NULL;
1835 stmt->limitCount = NULL;
1837 stmt->withClause = NULL;
1842 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1845 errmsg(
"%s is not allowed with UNION/INTERSECT/EXCEPT",
1847 linitial(lockingClause))->strength))));
1852 qry->hasRecursive = withClause->
recursive;
1868 node = sostmt->
larg;
1874 Assert(leftmostQuery != NULL);
1894 forfour(lct, sostmt->colTypes,
1895 lcm, sostmt->colTypmods,
1896 lcc, sostmt->colCollations,
1907 Assert(!lefttle->resjunk);
1908 colName =
pstrdup(lefttle->resname);
1921 targetvars =
lappend(targetvars, var);
1923 sortnscolumns[sortcolindex].
p_varno = leftmostRTI;
1925 sortnscolumns[sortcolindex].
p_vartype = colType;
1926 sortnscolumns[sortcolindex].
p_vartypmod = colTypmod;
1927 sortnscolumns[sortcolindex].
p_varcollid = colCollation;
1928 sortnscolumns[sortcolindex].
p_varnosyn = leftmostRTI;
1984 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1985 errmsg(
"invalid UNION/INTERSECT/EXCEPT ORDER BY clause"),
1986 errdetail(
"Only result column names can be used, not expressions or functions."),
1987 errhint(
"Add the expression/function to every SELECT, or move the UNION into a FROM clause."),
2008 foreach(l, lockingClause)
2040 &sortop, &eqop, NULL,
2049 if (require_hash && (rescoltype == RECORDOID || rescoltype == RECORDARRAYOID))
2058 grpcl->hashable = hashable;
2079 bool isTopLevel,
List **targetlist)
2091 if (
stmt->intoClause)
2093 (
errcode(ERRCODE_SYNTAX_ERROR),
2094 errmsg(
"INTO is only allowed on first SELECT of UNION/INTERSECT/EXCEPT"),
2099 if (
stmt->lockingClause)
2101 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2104 errmsg(
"%s is not allowed with UNION/INTERSECT/EXCEPT",
2122 if (
stmt->sortClause ||
stmt->limitOffset ||
stmt->limitCount ||
2123 stmt->lockingClause ||
stmt->withClause)
2152 NULL,
false,
false);
2164 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2165 errmsg(
"UNION/INTERSECT/EXCEPT member statement cannot refer to other relations of same query level"),
2181 *targetlist =
lappend(*targetlist, tle);
2199 return (
Node *) rtr;
2209 const char *context;
2233 if (isTopLevel && recursive)
2249 (
errcode(ERRCODE_SYNTAX_ERROR),
2250 errmsg(
"each %s query must have the same number of columns",
2258 op->colTypmods =
NIL;
2259 op->colCollations =
NIL;
2260 op->groupClauses =
NIL;
2261 forboth(ltl, ltargetlist, rtl, rtargetlist)
2309 if (lcoltype != UNKNOWNOID)
2311 rescoltype, context);
2316 rescoltype, context);
2320 if (rcoltype != UNKNOWNOID)
2322 rescoltype, context);
2327 rescoltype, context);
2349 op->colTypes =
lappend_oid(op->colTypes, rescoltype);
2350 op->colTypmods =
lappend_int(op->colTypmods, rescoltypmod);
2351 op->colCollations =
lappend_oid(op->colCollations, rescolcoll);
2369 op->groupClauses =
lappend(op->groupClauses,
2385 rescolnode->
typeId = rescoltype;
2386 rescolnode->typeMod = rescoltypmod;
2387 rescolnode->collation = rescolcoll;
2388 rescolnode->
location = bestlocation;
2393 *targetlist =
lappend(*targetlist, restle);
2410 Query *leftmostQuery;
2425 Assert(leftmostQuery != NULL);
2441 Assert(!lefttle->resjunk);
2442 colName =
pstrdup(lefttle->resname);
2447 targetList =
lappend(targetList, tle);
2465 qry->isReturn =
true;
2501 if (
stmt->withClause)
2503 qry->hasRecursive =
stmt->withClause->recursive;
2509 stmt->relation->inh,
2590 tle->resname = NULL;
2593 if (orig_tl == NULL)
2594 elog(
ERROR,
"UPDATE target count mismatch --- internal error");
2598 origTarget->
name,
true);
2601 (
errcode(ERRCODE_UNDEFINED_COLUMN),
2602 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
2607 errhint(
"SET target columns cannot be qualified with the relation name.") : 0,
2619 orig_tl =
lnext(origTlist, orig_tl);
2621 if (orig_tl != NULL)
2622 elog(
ERROR,
"UPDATE target count mismatch --- internal error");
2651 for (
int i = 0;
i < numattrs;
i++)
2652 nscolumns[
i].p_varreturningtype = returning_type;
2677 int save_next_resno;
2679 if (returningClause == NULL)
2691 if (qry->returningOldAlias != NULL)
2693 errcode(ERRCODE_SYNTAX_ERROR),
2695 errmsg(
"%s cannot be specified multiple times",
"OLD"),
2697 qry->returningOldAlias =
option->value;
2701 if (qry->returningNewAlias != NULL)
2703 errcode(ERRCODE_SYNTAX_ERROR),
2705 errmsg(
"%s cannot be specified multiple times",
"NEW"),
2707 qry->returningNewAlias =
option->value;
2716 errcode(ERRCODE_DUPLICATE_ALIAS),
2717 errmsg(
"table name \"%s\" specified more than once",
2730 if (qry->returningOldAlias == NULL &&
2733 qry->returningOldAlias =
"old";
2736 if (qry->returningNewAlias == NULL &&
2739 qry->returningNewAlias =
"new";
2753 returningClause->
exprs,
2764 (
errcode(ERRCODE_SYNTAX_ERROR),
2765 errmsg(
"RETURNING must have at least one column"),
2798 List *indirection =
stmt->indirection;
2799 int nnames =
stmt->nnames;
2802 bool save_resolve_unknowns;
2815 while (--nnames > 0 && indirection !=
NIL)
2820 elog(
ERROR,
"invalid name count in PLAssignStmt");
2839 passthru.
target = target;
2877 Oid targetcollation;
2888 (
errcode(ERRCODE_SYNTAX_ERROR),
2890 "assignment source returned %d columns",
2920 else if (targettype != type_id &&
2921 (targettype == RECORDOID ||
ISCOMPLEX(targettype)) &&
2922 (type_id == RECORDOID ||
ISCOMPLEX(type_id)))
2942 targettype, targettypmod,
2947 if (tle->
expr == NULL)
2949 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2950 errmsg(
"variable \"%s\" is of type %s"
2951 " but expression is of type %s",
2955 errhint(
"You will need to rewrite or cast the expression."),
2984 (
errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
2986 errmsg(
"cannot specify both %s and %s",
2987 "SCROLL",
"NO SCROLL")));
2992 (
errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
2994 errmsg(
"cannot specify both %s and %s",
2995 "ASENSITIVE",
"INSENSITIVE")));
3004 elog(
ERROR,
"unexpected non-SELECT command in DECLARE CURSOR");
3011 if (query->hasModifyingCTE)
3013 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3014 errmsg(
"DECLARE CURSOR must not contain data-modifying statements in WITH")));
3019 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3022 errmsg(
"DECLARE CURSOR WITH HOLD ... %s is not supported",
3025 errdetail(
"Holdable cursors must be READ ONLY.")));
3030 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3033 errmsg(
"DECLARE SCROLL CURSOR ... %s is not supported",
3036 errdetail(
"Scrollable cursors must be READ ONLY.")));
3041 (
errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
3044 errmsg(
"DECLARE INSENSITIVE CURSOR ... %s is not valid",
3047 errdetail(
"Insensitive cursors must be READ ONLY.")));
3072 bool generic_plan =
false;
3073 Oid *paramTypes = NULL;
3085 foreach(lc,
stmt->options)
3089 if (strcmp(opt->
defname,
"generic_plan") == 0)
3140 if (query->hasModifyingCTE)
3142 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3143 errmsg(
"materialized views must not use data-modifying statements in WITH")));
3152 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3153 errmsg(
"materialized views must not use temporary objects"),
3154 errdetail(
"This view depends on temporary %s.",
3164 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3165 errmsg(
"materialized views may not be defined using bound parameters")));
3174 if (
stmt->into->rel->relpersistence == RELPERSISTENCE_UNLOGGED)
3176 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3177 errmsg(
"materialized views cannot be unlogged")));
3217 foreach(lc,
stmt->funccall->args)
3225 stmt->funccall->funcname,
3230 stmt->funccall->location);
3248 fexpr->funcresulttype,
3253 Anum_pg_proc_proargmodes,
3273 elog(
ERROR,
"proargmodes is not a 1-D char array of length %d or it contains nulls",
3279 foreach(lc, fexpr->
args)
3283 switch (argmodes[
i])
3286 case PROARGMODE_VARIADIC:
3289 case PROARGMODE_OUT:
3290 outargs =
lappend(outargs, n);
3292 case PROARGMODE_INOUT:
3298 elog(
ERROR,
"invalid argmode %c for procedure",
3304 fexpr->
args = inargs;
3307 stmt->funcexpr = fexpr;
3308 stmt->outargs = outargs;
3333 return "FOR KEY SHARE";
3337 return "FOR NO KEY UPDATE";
3339 return "FOR UPDATE";
3356 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3359 errmsg(
"%s is not allowed with UNION/INTERSECT/EXCEPT",
3363 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3366 errmsg(
"%s is not allowed with DISTINCT clause",
3370 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3373 errmsg(
"%s is not allowed with GROUP BY clause",
3377 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3380 errmsg(
"%s is not allowed with HAVING clause",
3384 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3387 errmsg(
"%s is not allowed with aggregate functions",
3389 if (qry->hasWindowFuncs)
3391 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3394 errmsg(
"%s is not allowed with window functions",
3396 if (qry->hasTargetSRFs)
3398 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3401 errmsg(
"%s is not allowed with set-returning functions in the target list",
3431 if (lockedRels ==
NIL)
3490 foreach(l, lockedRels)
3497 (
errcode(ERRCODE_SYNTAX_ERROR),
3500 errmsg(
"%s must specify unqualified relation names",
3508 char *rtename = rte->eref->aliasname;
3523 if (rte->alias == NULL)
3527 if (rte->join_using_alias == NULL)
3529 rtename = rte->join_using_alias->aliasname;
3536 if (strcmp(rtename, thisrel->
relname) == 0)
3561 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3564 errmsg(
"%s cannot be applied to a join",
3570 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3573 errmsg(
"%s cannot be applied to a function",
3579 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3582 errmsg(
"%s cannot be applied to a table function",
3588 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3591 errmsg(
"%s cannot be applied to VALUES",
3597 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3600 errmsg(
"%s cannot be applied to a WITH query",
3606 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3609 errmsg(
"%s cannot be applied to a named tuplestore",
3617 elog(
ERROR,
"unrecognized RTE type: %d",
3629 errmsg(
"relation \"%s\" in %s clause not found in FROM clause",
3651 qry->hasForUpdate =
true;
3690#ifdef DEBUG_NODE_TESTS_ENABLED
3700test_raw_expression_coverage(
Node *node,
void *context)
3705 test_raw_expression_coverage,
void(* post_parse_analyze_hook_type)(ParseState *pstate, Query *query, JumbleState *jstate)
#define DatumGetArrayTypeP(X)
#define InvalidAttrNumber
void pgstat_report_query_id(int64 query_id, bool force)
Bitmapset * bms_add_member(Bitmapset *a, int x)
List * expand_function_arguments(List *args, bool include_out_arguments, Oid result_type, HeapTuple func_tuple)
bool defGetBoolean(DefElem *def)
bool query_uses_temp_object(Query *query, ObjectAddress *temp_object)
int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...)
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
Assert(PointerIsAligned(start, uint64))
#define HeapTupleIsValid(tuple)
if(TABLE==NULL||TABLE_index==NULL)
List * lappend(List *list, void *datum)
List * list_delete_first(List *list)
List * list_copy(const List *oldlist)
List * lappend_int(List *list, int datum)
List * lappend_oid(List *list, Oid datum)
List * list_delete_last(List *list)
void list_free(List *list)
List * list_truncate(List *list, int new_size)
Alias * makeAlias(const char *aliasname, List *colnames)
Var * makeVarFromTargetEntry(int varno, TargetEntry *tle)
FromExpr * makeFromExpr(List *fromlist, Node *quals)
Var * makeVar(int varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
Const * makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid)
TargetEntry * makeTargetEntry(Expr *expr, AttrNumber resno, char *resname, bool resjunk)
char * pstrdup(const char *in)
void * palloc0(Size size)
Oid exprType(const Node *expr)
int32 exprTypmod(const Node *expr)
Oid exprCollation(const Node *expr)
int exprLocation(const Node *expr)
#define raw_expression_tree_walker(n, w, c)
#define IsA(nodeptr, _type_)
#define castNode(_type_, nodeptr)
char * getObjectDescription(const ObjectAddress *object, bool missing_ok)
void(* ParserSetupHook)(ParseState *pstate, void *arg)
void parseCheckAggregates(ParseState *pstate, Query *qry)
Node * transformWhereClause(ParseState *pstate, Node *clause, ParseExprKind exprKind, const char *constructName)
List * transformGroupClause(ParseState *pstate, List *grouplist, bool groupByAll, List **groupingSets, List **targetlist, List *sortClause, ParseExprKind exprKind, bool useSQL99)
List * transformSortClause(ParseState *pstate, List *orderlist, List **targetlist, ParseExprKind exprKind, bool useSQL99)
List * transformDistinctOnClause(ParseState *pstate, List *distinctlist, List **targetlist, List *sortClause)
List * transformWindowDefinitions(ParseState *pstate, List *windowdefs, List **targetlist)
void transformFromClause(ParseState *pstate, List *frmList)
List * transformDistinctClause(ParseState *pstate, List **targetlist, List *sortClause, bool is_agg)
Node * transformLimitClause(ParseState *pstate, Node *clause, ParseExprKind exprKind, const char *constructName, LimitOption limitOption)
void transformOnConflictArbiter(ParseState *pstate, OnConflictClause *onConflictClause, List **arbiterExpr, Node **arbiterWhere, Oid *constraint)
int setTargetTable(ParseState *pstate, RangeVar *relation, bool inh, bool alsoSource, AclMode requiredPerms)
Node * coerce_to_common_type(ParseState *pstate, Node *node, Oid targetTypeId, const char *context)
int32 select_common_typmod(ParseState *pstate, List *exprs, Oid common_type)
Oid select_common_type(ParseState *pstate, List *exprs, const char *context, Node **which_expr)
Node * coerce_to_target_type(ParseState *pstate, Node *expr, Oid exprtype, Oid targettype, int32 targettypmod, CoercionContext ccontext, CoercionForm cformat, int location)
void assign_list_collations(ParseState *pstate, List *exprs)
Oid select_common_collation(ParseState *pstate, List *exprs, bool none_ok)
void assign_query_collations(ParseState *pstate, Query *query)
void assign_expr_collations(ParseState *pstate, Node *expr)
void analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, List *tlist)
List * transformWithClause(ParseState *pstate, WithClause *withClause)
Node * transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind)
Node * ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, Node *last_srf, FuncCall *fn, bool proc_call, int location)
Query * transformMergeStmt(ParseState *pstate, MergeStmt *stmt)
void cancel_parser_errposition_callback(ParseCallbackState *pcbstate)
void free_parsestate(ParseState *pstate)
int parser_errposition(ParseState *pstate, int location)
void setup_parser_errposition_callback(ParseCallbackState *pcbstate, ParseState *pstate, int location)
ParseState * make_parsestate(ParseState *parentParseState)
@ EXPR_KIND_INSERT_TARGET
@ EXPR_KIND_UPDATE_TARGET
@ EXPR_KIND_SELECT_TARGET
@ EXPR_KIND_CALL_ARGUMENT
@ EXPR_KIND_UPDATE_SOURCE
@ EXPR_KIND_VALUES_SINGLE
struct ParseNamespaceColumn ParseNamespaceColumn
void get_sort_group_operators(Oid argtype, bool needLT, bool needEQ, bool needGT, Oid *ltOpr, Oid *eqOpr, Oid *gtOpr, bool *isHashable)
void check_variable_parameters(ParseState *pstate, Query *query)
bool query_contains_extern_params(Query *query)
void setup_parse_variable_parameters(ParseState *pstate, Oid **paramTypes, int *numParams)
void setup_parse_fixed_parameters(ParseState *pstate, const Oid *paramTypes, int numParams)
ParseNamespaceItem * addRangeTableEntryForRelation(ParseState *pstate, Relation rel, int lockmode, Alias *alias, bool inh, bool inFromCl)
RTEPermissionInfo * getRTEPermissionInfo(List *rteperminfos, RangeTblEntry *rte)
RowMarkClause * get_parse_rowmark(Query *qry, Index rtindex)
TargetEntry * get_tle_by_resno(List *tlist, AttrNumber resno)
List * expandNSItemVars(ParseState *pstate, ParseNamespaceItem *nsitem, int sublevels_up, int location, List **colnames)
void addNSItemToQuery(ParseState *pstate, ParseNamespaceItem *nsitem, bool addToJoinList, bool addToRelNameSpace, bool addToVarNameSpace)
ParseNamespaceItem * addRangeTableEntryForSubquery(ParseState *pstate, Query *subquery, Alias *alias, bool lateral, bool inFromCl)
ParseNamespaceItem * addRangeTableEntryForJoin(ParseState *pstate, List *colnames, ParseNamespaceColumn *nscolumns, JoinType jointype, int nummergedcols, List *aliasvars, List *leftcols, List *rightcols, Alias *join_using_alias, Alias *alias, bool inFromCl)
List * expandNSItemAttrs(ParseState *pstate, ParseNamespaceItem *nsitem, int sublevels_up, bool require_col_privs, int location)
ParseNamespaceItem * refnameNamespaceItem(ParseState *pstate, const char *schemaname, const char *refname, int location, int *sublevels_up)
RangeTblEntry * GetRTEByRangeTablePosn(ParseState *pstate, int varno, int sublevels_up)
int attnameAttNum(Relation rd, const char *attname, bool sysColOK)
ParseNamespaceItem * addRangeTableEntryForValues(ParseState *pstate, List *exprs, List *coltypes, List *coltypmods, List *colcollations, Alias *alias, bool lateral, bool inFromCl)
Expr * transformAssignedExpr(ParseState *pstate, Expr *expr, ParseExprKind exprKind, const char *colname, int attrno, List *indirection, int location)
List * transformExpressionList(ParseState *pstate, List *exprlist, ParseExprKind exprKind, bool allowDefault)
Node * transformAssignmentIndirection(ParseState *pstate, Node *basenode, const char *targetName, bool targetIsSubscripting, Oid targetTypeId, int32 targetTypMod, Oid targetCollation, List *indirection, ListCell *indirection_cell, Node *rhs, CoercionContext ccontext, int location)
void updateTargetListEntry(ParseState *pstate, TargetEntry *tle, char *colname, int attrno, List *indirection, int location)
List * transformTargetList(ParseState *pstate, List *targetlist, ParseExprKind exprKind)
void resolveTargetListUnknowns(ParseState *pstate, List *targetlist)
void markTargetListOrigins(ParseState *pstate, List *targetlist)
List * checkInsertTargets(ParseState *pstate, List *cols, List **attrnos)
#define ISCOMPLEX(typeid)
#define CURSOR_OPT_INSENSITIVE
#define CURSOR_OPT_SCROLL
#define ACL_SELECT_FOR_UPDATE
#define CURSOR_OPT_ASENSITIVE
#define CURSOR_OPT_NO_SCROLL
static OnConflictExpr * transformOnConflictClause(ParseState *pstate, OnConflictClause *onConflictClause)
static Query * transformOptionalSelectInto(ParseState *pstate, Node *parseTree)
static void transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc, bool pushedDown)
static Query * transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt)
void CheckSelectLocking(Query *qry, LockClauseStrength strength)
SortGroupClause * makeSortGroupClauseForSetOp(Oid rescoltype, bool require_hash)
static Node * transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, bool isTopLevel, List **targetlist)
struct SelectStmtPassthrough SelectStmtPassthrough
Query * parse_analyze_withcb(RawStmt *parseTree, const char *sourceText, ParserSetupHook parserSetup, void *parserSetupArg, QueryEnvironment *queryEnv)
bool analyze_requires_snapshot(RawStmt *parseTree)
List * transformInsertRow(ParseState *pstate, List *exprlist, List *stmtcols, List *icolumns, List *attrnos, bool strip_indirection)
void applyLockingClause(Query *qry, Index rtindex, LockClauseStrength strength, LockWaitPolicy waitPolicy, bool pushedDown)
static void determineRecursiveColTypes(ParseState *pstate, Node *larg, List *nrtargetlist)
static Query * transformReturnStmt(ParseState *pstate, ReturnStmt *stmt)
static void addNSItemForReturning(ParseState *pstate, const char *aliasname, VarReturningType returning_type)
void transformReturningClause(ParseState *pstate, Query *qry, ReturningClause *returningClause, ParseExprKind exprKind)
static Query * transformPLAssignStmt(ParseState *pstate, PLAssignStmt *stmt)
static Query * transformCreateTableAsStmt(ParseState *pstate, CreateTableAsStmt *stmt)
post_parse_analyze_hook_type post_parse_analyze_hook
static Query * transformCallStmt(ParseState *pstate, CallStmt *stmt)
List * transformUpdateTargetList(ParseState *pstate, List *origTlist)
static Query * transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
bool query_requires_rewrite_plan(Query *query)
static Query * transformSelectStmt(ParseState *pstate, SelectStmt *stmt, SelectStmtPassthrough *passthru)
Query * transformTopLevelStmt(ParseState *pstate, RawStmt *parseTree)
const char * LCS_asString(LockClauseStrength strength)
Query * parse_analyze_fixedparams(RawStmt *parseTree, const char *sourceText, const Oid *paramTypes, int numParams, QueryEnvironment *queryEnv)
static Query * transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt)
Query * parse_sub_analyze(Node *parseTree, ParseState *parentParseState, CommonTableExpr *parentCTE, bool locked_from_parent, bool resolve_unknowns)
static Query * transformExplainStmt(ParseState *pstate, ExplainStmt *stmt)
List * BuildOnConflictExcludedTargetlist(Relation targetrel, Index exclRelIndex)
static List * transformPLAssignStmtTarget(ParseState *pstate, List *tlist, SelectStmtPassthrough *passthru)
static int count_rowexpr_columns(ParseState *pstate, Node *expr)
Query * parse_analyze_varparams(RawStmt *parseTree, const char *sourceText, Oid **paramTypes, int *numParams, QueryEnvironment *queryEnv)
bool stmt_requires_parse_analysis(RawStmt *parseTree)
static Query * transformDeclareCursorStmt(ParseState *pstate, DeclareCursorStmt *stmt)
static Query * transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
static Query * transformValuesClause(ParseState *pstate, SelectStmt *stmt)
Query * transformStmt(ParseState *pstate, Node *parseTree)
#define rt_fetch(rangetable_index, rangetable)
FormData_pg_attribute * Form_pg_attribute
#define lfirst_node(type, lc)
static int list_length(const List *l)
#define linitial_node(type, l)
#define forboth(cell1, list1, cell2, list2)
#define forthree(cell1, list1, cell2, list2, cell3, list3)
static void * list_nth(const List *list, int n)
#define foreach_node(type, var, lst)
#define forfour(cell1, list1, cell2, list2, cell3, list3, cell4, list4)
static ListCell * list_head(const List *l)
static ListCell * lnext(const List *l, const ListCell *c)
#define list_make2(x1, x2)
#define ERRCODE_UNDEFINED_TABLE
static Datum ObjectIdGetDatum(Oid X)
static bool IsQueryIdEnabled(void)
JumbleState * JumbleQuery(Query *query)
#define RelationGetNumberOfAttributes(relation)
#define RelationGetRelationName(relation)
void check_stack_depth(void)
LockClauseStrength strength
LockWaitPolicy waitPolicy
ParseNamespaceColumn * p_nscolumns
RTEPermissionInfo * p_perminfo
VarReturningType p_returning_type
ParseNamespaceItem * p_target_nsitem
ParseExprKind p_expr_kind
bool p_locked_from_parent
ParseParamRefHook p_paramref_hook
QueryEnvironment * p_queryEnv
const char * p_sourcetext
Relation p_target_relation
CommonTableExpr * p_parent_cte
LockClauseStrength strength
LockWaitPolicy waitPolicy
#define FirstLowInvalidHeapAttributeNumber
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
String * makeString(char *str)
bool contain_vars_of_level(Node *node, int levelsup)
int locate_var_of_level(Node *node, int levelsup)