72 bool isTopLevel,
List **targetlist);
90 #ifdef RAW_EXPRESSION_COVERAGE_TEST
91 static bool test_raw_expression_coverage(
Node *node,
void *context);
108 const Oid *paramTypes,
int numParams,
115 Assert(sourceText != NULL);
130 (*post_parse_analyze_hook) (pstate, query, jstate);
148 Oid **paramTypes,
int *numParams,
155 Assert(sourceText != NULL);
172 (*post_parse_analyze_hook) (pstate, query, jstate);
190 void *parserSetupArg,
197 Assert(sourceText != NULL);
201 (*parserSetup) (pstate, parserSetupArg);
209 (*post_parse_analyze_hook) (pstate, query, jstate);
226 bool locked_from_parent,
227 bool resolve_unknowns)
259 result->stmt_len = parseTree->
stmt_len;
286 if (
stmt->intoClause)
290 ctas->
query = parseTree;
300 stmt->intoClause = NULL;
302 parseTree = (
Node *) ctas;
323 #ifdef RAW_EXPRESSION_COVERAGE_TEST
331 (void) test_raw_expression_coverage(parseTree, NULL);
389 case T_DeclareCursorStmt:
399 case T_CreateTableAsStmt:
423 result->canSetTag =
true;
466 case T_DeclareCursorStmt:
468 case T_CreateTableAsStmt:
520 if (
stmt->withClause)
522 qry->hasRecursive =
stmt->withClause->recursive;
587 bool isGeneralSelect;
589 List *sub_rteperminfos;
598 bool isOnConflictUpdate;
608 if (
stmt->withClause)
610 qry->hasRecursive =
stmt->withClause->recursive;
615 qry->override =
stmt->override;
617 isOnConflictUpdate = (
stmt->onConflictClause &&
629 isGeneralSelect = (selectStmt && (selectStmt->
valuesLists ==
NIL ||
657 sub_rteperminfos =
NIL;
668 if (isOnConflictUpdate)
671 false,
false, targetPerms);
680 if (selectStmt == NULL)
689 else if (isGeneralSelect)
729 elog(
ERROR,
"unexpected non-SELECT command in INSERT ... SELECT");
775 exprList =
lappend(exprList, expr);
796 int sublist_length = -1;
797 bool lateral =
false;
799 Assert(selectStmt->intoClause == NULL);
801 foreach(lc, selectStmt->valuesLists)
817 if (sublist_length < 0)
825 (
errcode(ERRCODE_SYNTAX_ERROR),
826 errmsg(
"VALUES lists must all be the same length"),
860 exprsLists =
lappend(exprsLists, sublist);
893 coltypes, coltypmods, colcollations,
894 NULL, lateral,
true);
918 List *valuesLists = selectStmt->valuesLists;
921 Assert(selectStmt->intoClause == NULL);
943 perminfo = pstate->p_target_nsitem->p_perminfo;
944 qry->targetList =
NIL;
946 forthree(lc, exprList, icols, icolumns, attnos, attrnos)
957 qry->targetList =
lappend(qry->targetList, tle);
968 if (
stmt->onConflictClause ||
stmt->returningList)
970 pstate->p_namespace =
NIL;
976 if (
stmt->onConflictClause)
978 stmt->onConflictClause);
981 if (
stmt->returningList)
983 stmt->returningList);
986 qry->rtable = pstate->p_rtable;
987 qry->rteperminfos = pstate->p_rteperminfos;
990 qry->hasTargetSRFs = pstate->p_hasTargetSRFs;
991 qry->hasSubLinks = pstate->p_hasSubLinks;
1011 bool strip_indirection)
1027 (
errcode(ERRCODE_SYNTAX_ERROR),
1028 errmsg(
"INSERT has more expressions than target columns"),
1032 if (stmtcols !=
NIL &&
1045 (
errcode(ERRCODE_SYNTAX_ERROR),
1046 errmsg(
"INSERT has more target columns than expressions"),
1050 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),
1060 forthree(lc, exprlist, icols, icolumns, attnos, attrnos)
1073 if (strip_indirection)
1097 result =
lappend(result, expr);
1114 Oid arbiterConstraint;
1116 Node *onConflictWhere = NULL;
1117 int exclRelIndex = 0;
1137 exclRte = exclNSItem->
p_rte;
1145 exclRte->
relkind = RELKIND_COMPOSITE_TYPE;
1154 &arbiterWhere, &arbiterConstraint);
1232 if (attr->attisdropped)
1243 var =
makeVar(exclRelIndex, attno + 1,
1244 attr->atttypid, attr->atttypmod,
1266 targetrel->
rd_rel->reltype,
1296 if (
attnum > 0 && var->vartype == RECORDOID)
1307 if (ste == NULL || ste->resjunk)
1336 if (
stmt->withClause)
1338 qry->hasRecursive =
stmt->withClause->recursive;
1344 if (
stmt->intoClause)
1346 (
errcode(ERRCODE_SYNTAX_ERROR),
1347 errmsg(
"SELECT ... INTO is not allowed here"),
1396 if (
stmt->distinctClause ==
NIL)
1399 qry->hasDistinctOn =
false;
1408 qry->hasDistinctOn =
false;
1414 stmt->distinctClause,
1417 qry->hasDistinctOn =
true;
1447 foreach(l,
stmt->lockingClause)
1477 List **colexprs = NULL;
1478 int sublist_length = -1;
1479 bool lateral =
false;
1499 if (
stmt->withClause)
1501 qry->hasRecursive =
stmt->withClause->recursive;
1513 foreach(lc,
stmt->valuesLists)
1529 if (sublist_length < 0)
1539 (
errcode(ERRCODE_SYNTAX_ERROR),
1540 errmsg(
"VALUES lists must all be the same length"),
1547 foreach(lc2, sublist)
1551 colexprs[
i] =
lappend(colexprs[
i], col);
1576 for (
i = 0;
i < sublist_length;
i++)
1584 foreach(lc, colexprs[
i])
1589 lfirst(lc) = (
void *) col;
1597 colcollations =
lappend_oid(colcollations, colcoll);
1603 for (
i = 0;
i < sublist_length;
i++)
1605 forboth(lc, colexprs[
i], lc2, exprsLists)
1610 sublist =
lappend(sublist, col);
1630 coltypes, coltypmods, colcollations,
1631 NULL, lateral,
true);
1658 if (
stmt->lockingClause)
1660 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1663 errmsg(
"%s cannot be applied to VALUES",
1694 Query *leftmostQuery;
1699 List *lockingClause;
1710 int sv_rtable_length;
1726 leftmostSelect =
stmt->larg;
1727 while (leftmostSelect && leftmostSelect->
op !=
SETOP_NONE)
1728 leftmostSelect = leftmostSelect->
larg;
1730 leftmostSelect->
larg == NULL);
1733 (
errcode(ERRCODE_SYNTAX_ERROR),
1734 errmsg(
"SELECT ... INTO is not allowed here"),
1743 sortClause =
stmt->sortClause;
1744 limitOffset =
stmt->limitOffset;
1745 limitCount =
stmt->limitCount;
1746 lockingClause =
stmt->lockingClause;
1747 withClause =
stmt->withClause;
1750 stmt->limitOffset = NULL;
1751 stmt->limitCount = NULL;
1753 stmt->withClause = NULL;
1758 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1761 errmsg(
"%s is not allowed with UNION/INTERSECT/EXCEPT",
1763 linitial(lockingClause))->strength))));
1768 qry->hasRecursive = withClause->
recursive;
1784 node = sostmt->
larg;
1790 Assert(leftmostQuery != NULL);
1810 forfour(lct, sostmt->colTypes,
1811 lcm, sostmt->colTypmods,
1812 lcc, sostmt->colCollations,
1823 Assert(!lefttle->resjunk);
1824 colName =
pstrdup(lefttle->resname);
1837 targetvars =
lappend(targetvars, var);
1839 sortnscolumns[sortcolindex].
p_varno = leftmostRTI;
1841 sortnscolumns[sortcolindex].
p_vartype = colType;
1842 sortnscolumns[sortcolindex].
p_vartypmod = colTypmod;
1843 sortnscolumns[sortcolindex].
p_varcollid = colCollation;
1844 sortnscolumns[sortcolindex].
p_varnosyn = leftmostRTI;
1899 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1900 errmsg(
"invalid UNION/INTERSECT/EXCEPT ORDER BY clause"),
1901 errdetail(
"Only result column names can be used, not expressions or functions."),
1902 errhint(
"Add the expression/function to every SELECT, or move the UNION into a FROM clause."),
1923 foreach(l, lockingClause)
1955 &sortop, &eqop, NULL,
1964 if (require_hash && (rescoltype == RECORDOID || rescoltype == RECORDARRAYOID))
1972 grpcl->hashable = hashable;
1993 bool isTopLevel,
List **targetlist)
2005 if (
stmt->intoClause)
2007 (
errcode(ERRCODE_SYNTAX_ERROR),
2008 errmsg(
"INTO is only allowed on first SELECT of UNION/INTERSECT/EXCEPT"),
2013 if (
stmt->lockingClause)
2015 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2018 errmsg(
"%s is not allowed with UNION/INTERSECT/EXCEPT",
2036 if (
stmt->sortClause ||
stmt->limitOffset ||
stmt->limitCount ||
2037 stmt->lockingClause ||
stmt->withClause)
2047 char selectName[32];
2067 NULL,
false,
false);
2079 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2080 errmsg(
"UNION/INTERSECT/EXCEPT member statement cannot refer to other relations of same query level"),
2096 *targetlist =
lappend(*targetlist, tle);
2103 snprintf(selectName,
sizeof(selectName),
"*SELECT* %d",
2116 return (
Node *) rtr;
2126 const char *context;
2150 if (isTopLevel && recursive)
2166 (
errcode(ERRCODE_SYNTAX_ERROR),
2167 errmsg(
"each %s query must have the same number of columns",
2175 op->colTypmods =
NIL;
2176 op->colCollations =
NIL;
2177 op->groupClauses =
NIL;
2178 forboth(ltl, ltargetlist, rtl, rtargetlist)
2226 if (lcoltype != UNKNOWNOID)
2228 rescoltype, context);
2233 rescoltype, context);
2237 if (rcoltype != UNKNOWNOID)
2239 rescoltype, context);
2244 rescoltype, context);
2266 op->colTypes =
lappend_oid(op->colTypes, rescoltype);
2267 op->colTypmods =
lappend_int(op->colTypmods, rescoltypmod);
2268 op->colCollations =
lappend_oid(op->colCollations, rescolcoll);
2286 op->groupClauses =
lappend(op->groupClauses,
2302 rescolnode->
typeId = rescoltype;
2303 rescolnode->typeMod = rescoltypmod;
2304 rescolnode->collation = rescolcoll;
2305 rescolnode->
location = bestlocation;
2310 *targetlist =
lappend(*targetlist, restle);
2327 Query *leftmostQuery;
2342 Assert(leftmostQuery != NULL);
2358 Assert(!lefttle->resjunk);
2359 colName =
pstrdup(lefttle->resname);
2364 targetList =
lappend(targetList, tle);
2382 qry->isReturn =
true;
2418 if (
stmt->withClause)
2420 qry->hasRecursive =
stmt->withClause->recursive;
2426 stmt->relation->inh,
2506 tle->resname = NULL;
2509 if (orig_tl == NULL)
2510 elog(
ERROR,
"UPDATE target count mismatch --- internal error");
2514 origTarget->
name,
true);
2517 (
errcode(ERRCODE_UNDEFINED_COLUMN),
2518 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
2532 orig_tl =
lnext(origTlist, orig_tl);
2534 if (orig_tl != NULL)
2535 elog(
ERROR,
"UPDATE target count mismatch --- internal error");
2548 int save_next_resno;
2550 if (returningList ==
NIL)
2572 (
errcode(ERRCODE_SYNTAX_ERROR),
2573 errmsg(
"RETURNING must have at least one column"),
2607 List *indirection =
stmt->indirection;
2608 int nnames =
stmt->nnames;
2613 Oid targetcollation;
2631 while (--nnames > 0 && indirection !=
NIL)
2636 elog(
ERROR,
"invalid name count in PLAssignStmt");
2675 (
errcode(ERRCODE_SYNTAX_ERROR),
2677 "assignment source returned %d columns",
2707 else if (targettype != type_id &&
2708 (targettype == RECORDOID ||
ISCOMPLEX(targettype)) &&
2709 (type_id == RECORDOID ||
ISCOMPLEX(type_id)))
2729 targettype, targettypmod,
2734 if (tle->
expr == NULL)
2736 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2737 errmsg(
"variable \"%s\" is of type %s"
2738 " but expression is of type %s",
2742 errhint(
"You will need to rewrite or cast the expression."),
2781 qry->hasDistinctOn =
false;
2790 qry->hasDistinctOn =
false;
2799 qry->hasDistinctOn =
true;
2860 (
errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
2862 errmsg(
"cannot specify both %s and %s",
2863 "SCROLL",
"NO SCROLL")));
2868 (
errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
2870 errmsg(
"cannot specify both %s and %s",
2871 "ASENSITIVE",
"INSENSITIVE")));
2880 elog(
ERROR,
"unexpected non-SELECT command in DECLARE CURSOR");
2887 if (query->hasModifyingCTE)
2889 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2890 errmsg(
"DECLARE CURSOR must not contain data-modifying statements in WITH")));
2895 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2898 errmsg(
"DECLARE CURSOR WITH HOLD ... %s is not supported",
2901 errdetail(
"Holdable cursors must be READ ONLY.")));
2906 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2909 errmsg(
"DECLARE SCROLL CURSOR ... %s is not supported",
2912 errdetail(
"Scrollable cursors must be READ ONLY.")));
2917 (
errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
2920 errmsg(
"DECLARE INSENSITIVE CURSOR ... %s is not valid",
2923 errdetail(
"Insensitive cursors must be READ ONLY.")));
2948 bool generic_plan =
false;
2949 Oid *paramTypes = NULL;
2961 foreach(lc,
stmt->options)
2965 if (strcmp(opt->
defname,
"generic_plan") == 0)
3014 if (query->hasModifyingCTE)
3016 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3017 errmsg(
"materialized views must not use data-modifying statements in WITH")));
3026 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3027 errmsg(
"materialized views must not use temporary tables or views")));
3036 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3037 errmsg(
"materialized views may not be defined using bound parameters")));
3046 if (
stmt->into->rel->relpersistence == RELPERSISTENCE_UNLOGGED)
3048 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3049 errmsg(
"materialized views cannot be unlogged")));
3089 foreach(lc,
stmt->funccall->args)
3097 stmt->funccall->funcname,
3102 stmt->funccall->location);
3120 fexpr->funcresulttype,
3125 Anum_pg_proc_proargmodes,
3145 elog(
ERROR,
"proargmodes is not a 1-D char array of length %d or it contains nulls",
3151 foreach(lc, fexpr->
args)
3155 switch (argmodes[
i])
3158 case PROARGMODE_VARIADIC:
3161 case PROARGMODE_OUT:
3162 outargs =
lappend(outargs, n);
3164 case PROARGMODE_INOUT:
3170 elog(
ERROR,
"invalid argmode %c for procedure",
3176 fexpr->
args = inargs;
3179 stmt->funcexpr = fexpr;
3180 stmt->outargs = outargs;
3205 return "FOR KEY SHARE";
3209 return "FOR NO KEY UPDATE";
3211 return "FOR UPDATE";
3228 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3231 errmsg(
"%s is not allowed with UNION/INTERSECT/EXCEPT",
3235 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3238 errmsg(
"%s is not allowed with DISTINCT clause",
3242 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3245 errmsg(
"%s is not allowed with GROUP BY clause",
3249 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3252 errmsg(
"%s is not allowed with HAVING clause",
3256 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3259 errmsg(
"%s is not allowed with aggregate functions",
3261 if (qry->hasWindowFuncs)
3263 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3266 errmsg(
"%s is not allowed with window functions",
3268 if (qry->hasTargetSRFs)
3270 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3273 errmsg(
"%s is not allowed with set-returning functions in the target list",
3303 if (lockedRels ==
NIL)
3362 foreach(l, lockedRels)
3369 (
errcode(ERRCODE_SYNTAX_ERROR),
3372 errmsg(
"%s must specify unqualified relation names",
3395 if (rte->
alias == NULL)
3408 if (strcmp(rtename, thisrel->
relname) == 0)
3433 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3436 errmsg(
"%s cannot be applied to a join",
3442 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3445 errmsg(
"%s cannot be applied to a function",
3451 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3454 errmsg(
"%s cannot be applied to a table function",
3460 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3463 errmsg(
"%s cannot be applied to VALUES",
3469 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3472 errmsg(
"%s cannot be applied to a WITH query",
3478 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3481 errmsg(
"%s cannot be applied to a named tuplestore",
3489 elog(
ERROR,
"unrecognized RTE type: %d",
3501 errmsg(
"relation \"%s\" in %s clause not found in FROM clause",
3523 qry->hasForUpdate =
true;
3570 #ifdef RAW_EXPRESSION_COVERAGE_TEST
3573 test_raw_expression_coverage(
Node *node,
void *context)
3578 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)
List * expand_function_arguments(List *args, bool include_out_arguments, Oid result_type, HeapTuple func_tuple)
elog(ERROR, "%s: %s", p2, msg)
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)
Assert(fmt[strlen(fmt) - 1] !='\n')
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 List * transformReturningList(ParseState *pstate, List *returningList)
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)
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)