71 bool isTopLevel,
List **targetlist);
88 #ifdef DEBUG_NODE_TESTS_ENABLED
89 static bool test_raw_expression_coverage(
Node *node,
void *
context);
106 const Oid *paramTypes,
int numParams,
113 Assert(sourceText != NULL);
128 (*post_parse_analyze_hook) (pstate, query, jstate);
146 Oid **paramTypes,
int *numParams,
153 Assert(sourceText != NULL);
170 (*post_parse_analyze_hook) (pstate, query, jstate);
188 void *parserSetupArg,
195 Assert(sourceText != NULL);
199 (*parserSetup) (pstate, parserSetupArg);
207 (*post_parse_analyze_hook) (pstate, query, jstate);
224 bool locked_from_parent,
225 bool resolve_unknowns)
257 result->stmt_len = parseTree->
stmt_len;
284 if (
stmt->intoClause)
288 ctas->
query = parseTree;
298 stmt->intoClause = NULL;
300 parseTree = (
Node *) ctas;
316 #ifdef DEBUG_NODE_TESTS_ENABLED
324 if (Debug_raw_expression_coverage_test)
333 (void) test_raw_expression_coverage(parseTree, NULL);
392 case T_DeclareCursorStmt:
402 case T_CreateTableAsStmt:
426 result->canSetTag =
true;
469 case T_DeclareCursorStmt:
471 case T_CreateTableAsStmt:
523 if (
stmt->withClause)
525 qry->hasRecursive =
stmt->withClause->recursive;
591 bool isGeneralSelect;
593 List *sub_rteperminfos;
602 bool isOnConflictUpdate;
612 if (
stmt->withClause)
614 qry->hasRecursive =
stmt->withClause->recursive;
619 qry->override =
stmt->override;
621 isOnConflictUpdate = (
stmt->onConflictClause &&
633 isGeneralSelect = (selectStmt && (selectStmt->
valuesLists ==
NIL ||
661 sub_rteperminfos =
NIL;
672 if (isOnConflictUpdate)
675 false,
false, targetPerms);
684 if (selectStmt == NULL)
693 else if (isGeneralSelect)
733 elog(
ERROR,
"unexpected non-SELECT command in INSERT ... SELECT");
779 exprList =
lappend(exprList, expr);
800 int sublist_length = -1;
801 bool lateral =
false;
803 Assert(selectStmt->intoClause == NULL);
805 foreach(lc, selectStmt->valuesLists)
821 if (sublist_length < 0)
829 (
errcode(ERRCODE_SYNTAX_ERROR),
830 errmsg(
"VALUES lists must all be the same length"),
864 exprsLists =
lappend(exprsLists, sublist);
897 coltypes, coltypmods, colcollations,
898 NULL, lateral,
true);
922 List *valuesLists = selectStmt->valuesLists;
925 Assert(selectStmt->intoClause == NULL);
947 perminfo = pstate->p_target_nsitem->p_perminfo;
948 qry->targetList =
NIL;
950 forthree(lc, exprList, icols, icolumns, attnos, attrnos)
961 qry->targetList =
lappend(qry->targetList, tle);
972 if (
stmt->onConflictClause ||
stmt->returningList)
974 pstate->p_namespace =
NIL;
980 if (
stmt->onConflictClause)
982 stmt->onConflictClause);
985 if (
stmt->returningList)
991 qry->rtable = pstate->p_rtable;
992 qry->rteperminfos = pstate->p_rteperminfos;
995 qry->hasTargetSRFs = pstate->p_hasTargetSRFs;
996 qry->hasSubLinks = pstate->p_hasSubLinks;
1016 bool strip_indirection)
1032 (
errcode(ERRCODE_SYNTAX_ERROR),
1033 errmsg(
"INSERT has more expressions than target columns"),
1037 if (stmtcols !=
NIL &&
1050 (
errcode(ERRCODE_SYNTAX_ERROR),
1051 errmsg(
"INSERT has more target columns than expressions"),
1055 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),
1065 forthree(lc, exprlist, icols, icolumns, attnos, attrnos)
1078 if (strip_indirection)
1087 Expr *subexpr = expr;
1113 result =
lappend(result, expr);
1130 Oid arbiterConstraint;
1132 Node *onConflictWhere = NULL;
1133 int exclRelIndex = 0;
1153 exclRte = exclNSItem->
p_rte;
1161 exclRte->relkind = RELKIND_COMPOSITE_TYPE;
1170 &arbiterWhere, &arbiterConstraint);
1248 if (attr->attisdropped)
1259 var =
makeVar(exclRelIndex, attno + 1,
1260 attr->atttypid, attr->atttypmod,
1282 targetrel->
rd_rel->reltype,
1312 if (
attnum > 0 && var->vartype == RECORDOID)
1323 if (ste == NULL || ste->resjunk)
1352 if (
stmt->withClause)
1354 qry->hasRecursive =
stmt->withClause->recursive;
1360 if (
stmt->intoClause)
1362 (
errcode(ERRCODE_SYNTAX_ERROR),
1363 errmsg(
"SELECT ... INTO is not allowed here"),
1412 if (
stmt->distinctClause ==
NIL)
1415 qry->hasDistinctOn =
false;
1424 qry->hasDistinctOn =
false;
1430 stmt->distinctClause,
1433 qry->hasDistinctOn =
true;
1463 foreach(l,
stmt->lockingClause)
1493 List **colexprs = NULL;
1494 int sublist_length = -1;
1495 bool lateral =
false;
1515 if (
stmt->withClause)
1517 qry->hasRecursive =
stmt->withClause->recursive;
1529 foreach(lc,
stmt->valuesLists)
1545 if (sublist_length < 0)
1555 (
errcode(ERRCODE_SYNTAX_ERROR),
1556 errmsg(
"VALUES lists must all be the same length"),
1563 foreach(lc2, sublist)
1567 colexprs[
i] =
lappend(colexprs[
i], col);
1592 for (
i = 0;
i < sublist_length;
i++)
1600 foreach(lc, colexprs[
i])
1605 lfirst(lc) = (
void *) col;
1613 colcollations =
lappend_oid(colcollations, colcoll);
1619 for (
i = 0;
i < sublist_length;
i++)
1621 forboth(lc, colexprs[
i], lc2, exprsLists)
1626 sublist =
lappend(sublist, col);
1646 coltypes, coltypmods, colcollations,
1647 NULL, lateral,
true);
1674 if (
stmt->lockingClause)
1676 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1679 errmsg(
"%s cannot be applied to VALUES",
1710 Query *leftmostQuery;
1715 List *lockingClause;
1726 int sv_rtable_length;
1742 leftmostSelect =
stmt->larg;
1743 while (leftmostSelect && leftmostSelect->
op !=
SETOP_NONE)
1744 leftmostSelect = leftmostSelect->
larg;
1746 leftmostSelect->
larg == NULL);
1749 (
errcode(ERRCODE_SYNTAX_ERROR),
1750 errmsg(
"SELECT ... INTO is not allowed here"),
1759 sortClause =
stmt->sortClause;
1760 limitOffset =
stmt->limitOffset;
1761 limitCount =
stmt->limitCount;
1762 lockingClause =
stmt->lockingClause;
1763 withClause =
stmt->withClause;
1766 stmt->limitOffset = NULL;
1767 stmt->limitCount = NULL;
1769 stmt->withClause = NULL;
1774 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1777 errmsg(
"%s is not allowed with UNION/INTERSECT/EXCEPT",
1779 linitial(lockingClause))->strength))));
1784 qry->hasRecursive = withClause->
recursive;
1800 node = sostmt->
larg;
1806 Assert(leftmostQuery != NULL);
1826 forfour(lct, sostmt->colTypes,
1827 lcm, sostmt->colTypmods,
1828 lcc, sostmt->colCollations,
1839 Assert(!lefttle->resjunk);
1840 colName =
pstrdup(lefttle->resname);
1853 targetvars =
lappend(targetvars, var);
1855 sortnscolumns[sortcolindex].
p_varno = leftmostRTI;
1857 sortnscolumns[sortcolindex].
p_vartype = colType;
1858 sortnscolumns[sortcolindex].
p_vartypmod = colTypmod;
1859 sortnscolumns[sortcolindex].
p_varcollid = colCollation;
1860 sortnscolumns[sortcolindex].
p_varnosyn = leftmostRTI;
1916 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1917 errmsg(
"invalid UNION/INTERSECT/EXCEPT ORDER BY clause"),
1918 errdetail(
"Only result column names can be used, not expressions or functions."),
1919 errhint(
"Add the expression/function to every SELECT, or move the UNION into a FROM clause."),
1940 foreach(l, lockingClause)
1972 &sortop, &eqop, NULL,
1981 if (require_hash && (rescoltype == RECORDOID || rescoltype == RECORDARRAYOID))
1990 grpcl->hashable = hashable;
2011 bool isTopLevel,
List **targetlist)
2023 if (
stmt->intoClause)
2025 (
errcode(ERRCODE_SYNTAX_ERROR),
2026 errmsg(
"INTO is only allowed on first SELECT of UNION/INTERSECT/EXCEPT"),
2031 if (
stmt->lockingClause)
2033 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2036 errmsg(
"%s is not allowed with UNION/INTERSECT/EXCEPT",
2054 if (
stmt->sortClause ||
stmt->limitOffset ||
stmt->limitCount ||
2055 stmt->lockingClause ||
stmt->withClause)
2065 char selectName[32];
2085 NULL,
false,
false);
2097 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2098 errmsg(
"UNION/INTERSECT/EXCEPT member statement cannot refer to other relations of same query level"),
2114 *targetlist =
lappend(*targetlist, tle);
2121 snprintf(selectName,
sizeof(selectName),
"*SELECT* %d",
2134 return (
Node *) rtr;
2168 if (isTopLevel && recursive)
2184 (
errcode(ERRCODE_SYNTAX_ERROR),
2185 errmsg(
"each %s query must have the same number of columns",
2193 op->colTypmods =
NIL;
2194 op->colCollations =
NIL;
2195 op->groupClauses =
NIL;
2196 forboth(ltl, ltargetlist, rtl, rtargetlist)
2244 if (lcoltype != UNKNOWNOID)
2255 if (rcoltype != UNKNOWNOID)
2284 op->colTypes =
lappend_oid(op->colTypes, rescoltype);
2285 op->colTypmods =
lappend_int(op->colTypmods, rescoltypmod);
2286 op->colCollations =
lappend_oid(op->colCollations, rescolcoll);
2304 op->groupClauses =
lappend(op->groupClauses,
2320 rescolnode->
typeId = rescoltype;
2321 rescolnode->typeMod = rescoltypmod;
2322 rescolnode->collation = rescolcoll;
2323 rescolnode->
location = bestlocation;
2328 *targetlist =
lappend(*targetlist, restle);
2345 Query *leftmostQuery;
2360 Assert(leftmostQuery != NULL);
2376 Assert(!lefttle->resjunk);
2377 colName =
pstrdup(lefttle->resname);
2382 targetList =
lappend(targetList, tle);
2400 qry->isReturn =
true;
2436 if (
stmt->withClause)
2438 qry->hasRecursive =
stmt->withClause->recursive;
2444 stmt->relation->inh,
2525 tle->resname = NULL;
2528 if (orig_tl == NULL)
2529 elog(
ERROR,
"UPDATE target count mismatch --- internal error");
2533 origTarget->
name,
true);
2536 (
errcode(ERRCODE_UNDEFINED_COLUMN),
2537 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
2542 errhint(
"SET target columns cannot be qualified with the relation name.") : 0,
2554 orig_tl =
lnext(origTlist, orig_tl);
2556 if (orig_tl != NULL)
2557 elog(
ERROR,
"UPDATE target count mismatch --- internal error");
2571 int save_next_resno;
2573 if (returningList ==
NIL)
2595 (
errcode(ERRCODE_SYNTAX_ERROR),
2596 errmsg(
"RETURNING must have at least one column"),
2630 List *indirection =
stmt->indirection;
2631 int nnames =
stmt->nnames;
2636 Oid targetcollation;
2654 while (--nnames > 0 && indirection !=
NIL)
2659 elog(
ERROR,
"invalid name count in PLAssignStmt");
2698 (
errcode(ERRCODE_SYNTAX_ERROR),
2700 "assignment source returned %d columns",
2730 else if (targettype != type_id &&
2731 (targettype == RECORDOID ||
ISCOMPLEX(targettype)) &&
2732 (type_id == RECORDOID ||
ISCOMPLEX(type_id)))
2752 targettype, targettypmod,
2757 if (tle->
expr == NULL)
2759 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2760 errmsg(
"variable \"%s\" is of type %s"
2761 " but expression is of type %s",
2765 errhint(
"You will need to rewrite or cast the expression."),
2804 qry->hasDistinctOn =
false;
2813 qry->hasDistinctOn =
false;
2822 qry->hasDistinctOn =
true;
2883 (
errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
2885 errmsg(
"cannot specify both %s and %s",
2886 "SCROLL",
"NO SCROLL")));
2891 (
errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
2893 errmsg(
"cannot specify both %s and %s",
2894 "ASENSITIVE",
"INSENSITIVE")));
2903 elog(
ERROR,
"unexpected non-SELECT command in DECLARE CURSOR");
2910 if (query->hasModifyingCTE)
2912 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2913 errmsg(
"DECLARE CURSOR must not contain data-modifying statements in WITH")));
2918 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2921 errmsg(
"DECLARE CURSOR WITH HOLD ... %s is not supported",
2924 errdetail(
"Holdable cursors must be READ ONLY.")));
2929 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2932 errmsg(
"DECLARE SCROLL CURSOR ... %s is not supported",
2935 errdetail(
"Scrollable cursors must be READ ONLY.")));
2940 (
errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
2943 errmsg(
"DECLARE INSENSITIVE CURSOR ... %s is not valid",
2946 errdetail(
"Insensitive cursors must be READ ONLY.")));
2971 bool generic_plan =
false;
2972 Oid *paramTypes = NULL;
2984 foreach(lc,
stmt->options)
2988 if (strcmp(opt->
defname,
"generic_plan") == 0)
3037 if (query->hasModifyingCTE)
3039 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3040 errmsg(
"materialized views must not use data-modifying statements in WITH")));
3049 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3050 errmsg(
"materialized views must not use temporary tables or views")));
3059 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3060 errmsg(
"materialized views may not be defined using bound parameters")));
3069 if (
stmt->into->rel->relpersistence == RELPERSISTENCE_UNLOGGED)
3071 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3072 errmsg(
"materialized views cannot be unlogged")));
3112 foreach(lc,
stmt->funccall->args)
3120 stmt->funccall->funcname,
3125 stmt->funccall->location);
3143 fexpr->funcresulttype,
3148 Anum_pg_proc_proargmodes,
3168 elog(
ERROR,
"proargmodes is not a 1-D char array of length %d or it contains nulls",
3174 foreach(lc, fexpr->
args)
3178 switch (argmodes[
i])
3181 case PROARGMODE_VARIADIC:
3184 case PROARGMODE_OUT:
3185 outargs =
lappend(outargs, n);
3187 case PROARGMODE_INOUT:
3193 elog(
ERROR,
"invalid argmode %c for procedure",
3199 fexpr->
args = inargs;
3202 stmt->funcexpr = fexpr;
3203 stmt->outargs = outargs;
3228 return "FOR KEY SHARE";
3232 return "FOR NO KEY UPDATE";
3234 return "FOR UPDATE";
3251 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3254 errmsg(
"%s is not allowed with UNION/INTERSECT/EXCEPT",
3258 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3261 errmsg(
"%s is not allowed with DISTINCT clause",
3265 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3268 errmsg(
"%s is not allowed with GROUP BY clause",
3272 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3275 errmsg(
"%s is not allowed with HAVING clause",
3279 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3282 errmsg(
"%s is not allowed with aggregate functions",
3284 if (qry->hasWindowFuncs)
3286 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3289 errmsg(
"%s is not allowed with window functions",
3291 if (qry->hasTargetSRFs)
3293 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3296 errmsg(
"%s is not allowed with set-returning functions in the target list",
3326 if (lockedRels ==
NIL)
3385 foreach(l, lockedRels)
3392 (
errcode(ERRCODE_SYNTAX_ERROR),
3395 errmsg(
"%s must specify unqualified relation names",
3403 char *rtename = rte->eref->aliasname;
3418 if (rte->alias == NULL)
3422 if (rte->join_using_alias == NULL)
3424 rtename = rte->join_using_alias->aliasname;
3431 if (strcmp(rtename, thisrel->
relname) == 0)
3456 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3459 errmsg(
"%s cannot be applied to a join",
3465 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3468 errmsg(
"%s cannot be applied to a function",
3474 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3477 errmsg(
"%s cannot be applied to a table function",
3483 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3486 errmsg(
"%s cannot be applied to VALUES",
3492 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3495 errmsg(
"%s cannot be applied to a WITH query",
3501 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3504 errmsg(
"%s cannot be applied to a named tuplestore",
3512 elog(
ERROR,
"unrecognized RTE type: %d",
3524 errmsg(
"relation \"%s\" in %s clause not found in FROM clause",
3546 qry->hasForUpdate =
true;
3585 #ifdef DEBUG_NODE_TESTS_ENABLED
3595 test_raw_expression_coverage(
Node *node,
void *
context)
3600 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(uint64 query_id, bool force)
Bitmapset * bms_add_member(Bitmapset *a, int x)
#define Assert(condition)
List * expand_function_arguments(List *args, bool include_out_arguments, Oid result_type, HeapTuple func_tuple)
bool defGetBoolean(DefElem *def)
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,...)
#define HeapTupleIsValid(tuple)
if(TABLE==NULL||TABLE_index==NULL)
List * list_truncate(List *list, int new_size)
List * lappend(List *list, void *datum)
List * lappend_int(List *list, int datum)
List * lappend_oid(List *list, Oid datum)
List * list_copy(const List *oldlist)
List * list_delete_first(List *list)
void list_free(List *list)
List * list_delete_last(List *list)
Alias * makeAlias(const char *aliasname, List *colnames)
Var * makeVarFromTargetEntry(int varno, TargetEntry *tle)
TargetEntry * makeTargetEntry(Expr *expr, AttrNumber resno, char *resname, bool resjunk)
Const * makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid)
FromExpr * makeFromExpr(List *fromlist, Node *quals)
Var * makeVar(int varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
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)
void(* ParserSetupHook)(struct ParseState *pstate, void *arg)
void parseCheckAggregates(ParseState *pstate, Query *qry)
List * transformWindowDefinitions(ParseState *pstate, List *windowdefs, List **targetlist)
List * transformDistinctOnClause(ParseState *pstate, List *distinctlist, List **targetlist, List *sortClause)
Node * transformLimitClause(ParseState *pstate, Node *clause, ParseExprKind exprKind, const char *constructName, LimitOption limitOption)
List * transformSortClause(ParseState *pstate, List *orderlist, List **targetlist, ParseExprKind exprKind, bool useSQL99)
Node * transformWhereClause(ParseState *pstate, Node *clause, ParseExprKind exprKind, const char *constructName)
void transformFromClause(ParseState *pstate, List *frmList)
List * transformGroupClause(ParseState *pstate, List *grouplist, List **groupingSets, List **targetlist, List *sortClause, ParseExprKind exprKind, bool useSQL99)
List * transformDistinctClause(ParseState *pstate, List **targetlist, List *sortClause, bool is_agg)
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)
Node * coerce_to_target_type(ParseState *pstate, Node *expr, Oid exprtype, Oid targettype, int32 targettypmod, CoercionContext ccontext, CoercionForm cformat, int location)
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)
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)
RangeTblEntry * GetRTEByRangeTablePosn(ParseState *pstate, int varno, int sublevels_up)
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)
RowMarkClause * get_parse_rowmark(Query *qry, Index rtindex)
ParseNamespaceItem * addRangeTableEntryForRelation(ParseState *pstate, Relation rel, int lockmode, Alias *alias, bool inh, bool inFromCl)
RTEPermissionInfo * getRTEPermissionInfo(List *rteperminfos, RangeTblEntry *rte)
TargetEntry * get_tle_by_resno(List *tlist, AttrNumber resno)
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 * addRangeTableEntryForValues(ParseState *pstate, List *exprs, List *coltypes, List *coltypmods, List *colcollations, Alias *alias, bool lateral, bool inFromCl)
List * expandNSItemVars(ParseState *pstate, ParseNamespaceItem *nsitem, int sublevels_up, int location, List **colnames)
List * expandNSItemAttrs(ParseState *pstate, ParseNamespaceItem *nsitem, int sublevels_up, bool require_col_privs, int location)
bool isQueryUsingTempRelation(Query *query)
int attnameAttNum(Relation rd, const char *attname, bool sysColOK)
List * transformTargetList(ParseState *pstate, List *targetlist, ParseExprKind exprKind)
Expr * transformAssignedExpr(ParseState *pstate, Expr *expr, ParseExprKind exprKind, const char *colname, int attrno, List *indirection, int location)
void updateTargetListEntry(ParseState *pstate, TargetEntry *tle, char *colname, int attrno, List *indirection, int location)
void resolveTargetListUnknowns(ParseState *pstate, List *targetlist)
void markTargetListOrigins(ParseState *pstate, List *targetlist)
List * checkInsertTargets(ParseState *pstate, List *cols, List **attrnos)
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)
List * transformExpressionList(ParseState *pstate, List *exprlist, ParseExprKind exprKind, bool allowDefault)
#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)
Query * parse_analyze_withcb(RawStmt *parseTree, const char *sourceText, ParserSetupHook parserSetup, void *parserSetupArg, QueryEnvironment *queryEnv)
List * transformUpdateTargetList(ParseState *pstate, List *origTlist)
Query * parse_sub_analyze(Node *parseTree, ParseState *parentParseState, CommonTableExpr *parentCTE, bool locked_from_parent, bool resolve_unknowns)
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)
List * transformInsertRow(ParseState *pstate, List *exprlist, List *stmtcols, List *icolumns, List *attrnos, bool strip_indirection)
void CheckSelectLocking(Query *qry, LockClauseStrength strength)
static Node * transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, bool isTopLevel, List **targetlist)
Query * transformTopLevelStmt(ParseState *pstate, RawStmt *parseTree)
bool analyze_requires_snapshot(RawStmt *parseTree)
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 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)
static Query * transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
List * BuildOnConflictExcludedTargetlist(Relation targetrel, Index exclRelIndex)
SortGroupClause * makeSortGroupClauseForSetOp(Oid rescoltype, bool require_hash)
const char * LCS_asString(LockClauseStrength strength)
static Query * transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt)
static Query * transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
static Query * transformExplainStmt(ParseState *pstate, ExplainStmt *stmt)
Query * transformStmt(ParseState *pstate, Node *parseTree)
Query * parse_analyze_varparams(RawStmt *parseTree, const char *sourceText, Oid **paramTypes, int *numParams, QueryEnvironment *queryEnv)
static int count_rowexpr_columns(ParseState *pstate, Node *expr)
List * transformReturningList(ParseState *pstate, List *returningList, ParseExprKind exprKind)
Query * parse_analyze_fixedparams(RawStmt *parseTree, const char *sourceText, const 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)
#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 ListCell * list_head(const List *l)
#define forfour(cell1, list1, cell2, list2, cell3, list3, cell4, list4)
static void * list_nth(const List *list, int n)
static ListCell * lnext(const List *l, const ListCell *c)
#define list_make2(x1, x2)
#define ERRCODE_UNDEFINED_TABLE
void check_stack_depth(void)
static Datum ObjectIdGetDatum(Oid X)
static bool IsQueryIdEnabled(void)
JumbleState * JumbleQuery(Query *query)
#define RelationGetNumberOfAttributes(relation)
#define RelationGetRelationName(relation)
LockClauseStrength strength
LockWaitPolicy waitPolicy
RTEPermissionInfo * p_perminfo
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)
#define TupleDescAttr(tupdesc, i)
String * makeString(char *str)
bool contain_vars_of_level(Node *node, int levelsup)
int locate_var_of_level(Node *node, int levelsup)