57#include "utils/fmgroids.h"
110#ifdef DEBUG_NODE_TESTS_ENABLED
128 const Oid *paramTypes,
int numParams,
150 (*post_parse_analyze_hook) (pstate, query,
jstate);
168 Oid **paramTypes,
int *numParams,
192 (*post_parse_analyze_hook) (pstate, query,
jstate);
210 void *parserSetupArg,
221 (*parserSetup) (pstate, parserSetupArg);
229 (*post_parse_analyze_hook) (pstate, query,
jstate);
306 if (
stmt->intoClause)
313 ctas->is_select_into =
true;
338#ifdef DEBUG_NODE_TESTS_ENABLED
584 if (
stmt->withClause)
586 qry->hasRecursive =
stmt->withClause->recursive;
599 if (
stmt->whereClause &&
604 errmsg(
"WHERE CURRENT OF on a view is not implemented"));
610 nsitem->p_lateral_only =
true;
611 nsitem->p_lateral_ok =
false;
622 nsitem->p_lateral_only =
false;
623 nsitem->p_lateral_ok =
true;
625 if (
stmt->forPortionOf)
686 if (
stmt->withClause)
688 qry->hasRecursive =
stmt->withClause->recursive;
693 qry->override =
stmt->override;
764 if (selectStmt ==
NULL)
813 elog(
ERROR,
"unexpected non-SELECT command in INSERT ... SELECT");
881 bool lateral =
false;
910 errmsg(
"VALUES lists must all be the same length"),
978 NULL, lateral,
true);
1052 if (
stmt->onConflictClause ||
stmt->returningClause)
1060 if (
stmt->onConflictClause &&
1062 !
stmt->returningClause)
1065 errmsg(
"ON CONFLICT DO SELECT requires a RETURNING clause"),
1069 if (
stmt->onConflictClause)
1071 stmt->onConflictClause);
1074 if (
stmt->returningClause)
1121 errmsg(
"INSERT has more expressions than target columns"),
1139 errmsg(
"INSERT has more target columns than expressions"),
1143 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),
1175 Expr *subexpr = expr;
1221 int exclRelIndex = 0;
1294 result->arbiterElems = arbiterElems;
1295 result->arbiterWhere = arbiterWhere;
1298 result->onConflictSet = onConflictSet;
1299 result->onConflictWhere = onConflictWhere;
1300 result->exclRelIndex = exclRelIndex;
1301 result->exclRelTlist = exclRelTlist;
1342 errmsg(
"foreign tables don't support FOR PORTION OF")));
1351 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
1366 result->rangeVar = rangeVar;
1378 if (forPortionOf->
target)
1398 errmsg(
"could not coerce FOR PORTION OF target from %s to %s",
1419 errmsg(
"column \"%s\" of relation \"%s\" is not a range or multirange type",
1440 errmsg(
"column \"%s\" of relation \"%s\" is not a range type",
1472 errmsg(
"could not coerce FOR PORTION OF %s bound from %s to %s",
1480 errmsg(
"could not coerce FOR PORTION OF %s bound from %s to %s",
1494 (
errmsg(
"FOR PORTION OF bounds cannot contain volatile functions")));
1505 errmsg(
"data type %s has no default operator class for access method \"%s\"",
1507 errhint(
"You must define a default operator class for the data type.")));
1536 elog(
ERROR,
"unexpected opcintype: %u", opcintype);
1539 elog(
ERROR,
"unexpected opclass: %u", opclass);
1567 elog(
ERROR,
"unexpected opcintype: %u", opcintype);
1573 errmsg(
"could not identify an intersect function for type %s",
1645 if (attr->attisdropped)
1656 var =
makeVar(exclRelIndex, attno + 1,
1657 attr->atttypid, attr->atttypmod,
1757 if (
stmt->withClause)
1759 qry->hasRecursive =
stmt->withClause->recursive;
1765 if (
stmt->intoClause)
1768 errmsg(
"SELECT ... INTO is not allowed here"),
1827 if (
stmt->distinctClause ==
NIL)
1830 qry->hasDistinctOn =
false;
1839 qry->hasDistinctOn =
false;
1845 stmt->distinctClause,
1848 qry->hasDistinctOn =
true;
1878 foreach(l,
stmt->lockingClause)
1910 bool lateral =
false;
1930 if (
stmt->withClause)
1932 qry->hasRecursive =
stmt->withClause->recursive;
1944 foreach(
lc,
stmt->valuesLists)
1971 errmsg(
"VALUES lists must all be the same length"),
2015 foreach(
lc, colexprs[
i])
2062 NULL, lateral,
true);
2089 if (
stmt->lockingClause)
2094 errmsg(
"%s cannot be applied to VALUES",
2130 List *lockingClause;
2165 errmsg(
"SELECT ... INTO is not allowed here"),
2174 sortClause =
stmt->sortClause;
2175 limitOffset =
stmt->limitOffset;
2176 limitCount =
stmt->limitCount;
2177 lockingClause =
stmt->lockingClause;
2178 withClause =
stmt->withClause;
2192 errmsg(
"%s is not allowed with UNION/INTERSECT/EXCEPT",
2194 linitial(lockingClause))->strength))));
2199 qry->hasRecursive = withClause->
recursive;
2332 errmsg(
"invalid UNION/INTERSECT/EXCEPT ORDER BY clause"),
2333 errdetail(
"Only result column names can be used, not expressions or functions."),
2334 errhint(
"Add the expression/function to every SELECT, or move the UNION into a FROM clause."),
2355 foreach(l, lockingClause)
2387 &sortop, &eqop,
NULL,
2400 grpcl->tleSortGroupRef = 0;
2402 grpcl->sortop = sortop;
2403 grpcl->reverse_sort =
false;
2404 grpcl->nulls_first =
false;
2405 grpcl->hashable = hashable;
2438 if (
stmt->intoClause)
2441 errmsg(
"INTO is only allowed on first SELECT of UNION/INTERSECT/EXCEPT"),
2446 if (
stmt->lockingClause)
2451 errmsg(
"%s is not allowed with UNION/INTERSECT/EXCEPT",
2469 if (
stmt->sortClause ||
stmt->limitOffset ||
stmt->limitCount ||
2470 stmt->lockingClause ||
stmt->withClause)
2498 NULL,
false,
false);
2511 errmsg(
"UNION/INTERSECT/EXCEPT member statement cannot refer to other relations of same query level"),
2555 const char *context;
2590 context, recursive);
2611 List **targetlist,
const char *context,
bool recursive)
2623 errmsg(
"each %s query must have the same number of columns",
2631 op->colTypmods =
NIL;
2632 op->colCollations =
NIL;
2633 op->groupClauses =
NIL;
2739 op->groupClauses =
lappend(op->groupClauses,
2832 qry->isReturn =
true;
2867 if (
stmt->withClause)
2869 qry->hasRecursive =
stmt->withClause->recursive;
2875 stmt->relation->inh,
2880 if (
stmt->whereClause &&
2885 errmsg(
"WHERE CURRENT OF on a view is not implemented"));
2887 if (
stmt->forPortionOf)
2889 qry->resultRelation,
2897 nsitem->p_lateral_ok =
false;
2906 nsitem->p_lateral_only =
false;
2907 nsitem->p_lateral_ok =
true;
2976 elog(
ERROR,
"UPDATE target count mismatch --- internal error");
2984 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
2989 errhint(
"SET target columns cannot be qualified with the relation name.") : 0,
2996 if (forPortionOf !=
NULL)
3001 errmsg(
"cannot update column \"%s\" because it is used in FOR PORTION OF",
3018 elog(
ERROR,
"UPDATE target count mismatch --- internal error");
3047 nscolumns[
i].p_varreturningtype = returning_type;
3056 nsitem->p_returning_type = returning_type;
3074 if (returningClause ==
NULL)
3086 if (qry->returningOldAlias !=
NULL)
3090 errmsg(
"%s cannot be specified multiple times",
"OLD"),
3092 qry->returningOldAlias =
option->value;
3096 if (qry->returningNewAlias !=
NULL)
3100 errmsg(
"%s cannot be specified multiple times",
"NEW"),
3102 qry->returningNewAlias =
option->value;
3112 errmsg(
"table name \"%s\" specified more than once",
3125 if (qry->returningOldAlias ==
NULL &&
3128 qry->returningOldAlias =
"old";
3131 if (qry->returningNewAlias ==
NULL &&
3134 qry->returningNewAlias =
"new";
3148 returningClause->
exprs,
3160 errmsg(
"RETURNING must have at least one column"),
3193 List *indirection =
stmt->indirection;
3194 int nnames =
stmt->nnames;
3210 while (--nnames > 0 && indirection !=
NIL)
3215 elog(
ERROR,
"invalid name count in PLAssignStmt");
3235 passthru.indirection = indirection;
3285 "assignment source returned %d columns",
3315 else if (targettype != type_id &&
3337 targettype, targettypmod,
3345 errmsg(
"variable \"%s\" is of type %s"
3346 " but expression is of type %s",
3350 errhint(
"You will need to rewrite or cast the expression."),
3381 errmsg(
"cannot specify both %s and %s",
3382 "SCROLL",
"NO SCROLL")));
3389 errmsg(
"cannot specify both %s and %s",
3390 "ASENSITIVE",
"INSENSITIVE")));
3399 elog(
ERROR,
"unexpected non-SELECT command in DECLARE CURSOR");
3406 if (query->hasModifyingCTE)
3409 errmsg(
"DECLARE CURSOR must not contain data-modifying statements in WITH")));
3417 errmsg(
"DECLARE CURSOR WITH HOLD ... %s is not supported",
3420 errdetail(
"Holdable cursors must be READ ONLY.")));
3428 errmsg(
"DECLARE SCROLL CURSOR ... %s is not supported",
3431 errdetail(
"Scrollable cursors must be READ ONLY.")));
3439 errmsg(
"DECLARE INSENSITIVE CURSOR ... %s is not valid",
3442 errdetail(
"Insensitive cursors must be READ ONLY.")));
3480 foreach(
lc,
stmt->options)
3535 if (query->hasModifyingCTE)
3538 errmsg(
"materialized views must not use data-modifying statements in WITH")));
3548 errmsg(
"materialized views must not use temporary objects"),
3549 errdetail(
"This view depends on temporary %s.",
3560 errmsg(
"materialized views may not be defined using bound parameters")));
3572 errmsg(
"materialized views cannot be unlogged")));
3612 foreach(
lc,
stmt->funccall->args)
3620 stmt->funccall->funcname,
3625 stmt->funccall->location);
3633 elog(
ERROR,
"cache lookup failed for function %u",
fexpr->funcid);
3643 fexpr->funcresulttype,
3668 elog(
ERROR,
"proargmodes is not a 1-D char array of length %d or it contains nulls",
3685 outargs =
lappend(outargs, n);
3693 elog(
ERROR,
"invalid argmode %c for procedure",
3703 stmt->outargs = outargs;
3728 return "FOR KEY SHARE";
3732 return "FOR NO KEY UPDATE";
3734 return "FOR UPDATE";
3754 errmsg(
"%s is not allowed with UNION/INTERSECT/EXCEPT",
3761 errmsg(
"%s is not allowed with DISTINCT clause",
3768 errmsg(
"%s is not allowed with GROUP BY clause",
3775 errmsg(
"%s is not allowed with HAVING clause",
3782 errmsg(
"%s is not allowed with aggregate functions",
3784 if (qry->hasWindowFuncs)
3789 errmsg(
"%s is not allowed with window functions",
3791 if (qry->hasTargetSRFs)
3796 errmsg(
"%s is not allowed with set-returning functions in the target list",
3812 List *lockedRels =
lc->lockedRels;
3826 if (lockedRels ==
NIL)
3844 switch (
rte->rtekind)
3885 foreach(l, lockedRels)
3895 errmsg(
"%s must specify unqualified relation names",
3922 if (
rte->join_using_alias ==
NULL)
3933 switch (
rte->rtekind)
3949 lc->waitPolicy, pushedDown);
3959 errmsg(
"%s cannot be applied to a join",
3968 errmsg(
"%s cannot be applied to a function",
3977 errmsg(
"%s cannot be applied to a table function",
3986 errmsg(
"%s cannot be applied to VALUES",
3995 errmsg(
"%s cannot be applied to a WITH query",
4004 errmsg(
"%s cannot be applied to a named tuplestore",
4012 elog(
ERROR,
"unrecognized RTE type: %d",
4013 (
int)
rte->rtekind);
4024 errmsg(
"relation \"%s\" in %s clause not found in FROM clause",
4046 qry->hasForUpdate =
true;
4085#ifdef DEBUG_NODE_TESTS_ENABLED
void(* post_parse_analyze_hook_type)(ParseState *pstate, Query *query, const 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)
#define Assert(condition)
#define OidIsValid(objectId)
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
bool contain_volatile_functions_after_planning(Expr *expr)
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 errcode(int sqlerrcode)
int errhint(const char *fmt,...) pg_attribute_printf(1
int errdetail(const char *fmt,...) pg_attribute_printf(1
int int int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1
#define ereport(elevel,...)
#define palloc_object(type)
#define palloc_array(type, count)
#define HeapTupleIsValid(tuple)
Oid GetDefaultOpClass(Oid type_id, Oid am_id)
void GetOperatorFromCompareType(Oid opclass, Oid rhstype, CompareType cmptype, Oid *opid, StrategyNumber *strat)
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)
Oid get_range_subtype(Oid rangeOid)
RegProcedure get_range_constructor2(Oid rangeOid)
bool type_is_range(Oid typid)
bool get_opclass_opfamily_and_input_type(Oid opclass, Oid *opfamily, Oid *opcintype)
RegProcedure get_opcode(Oid opno)
Oid getBaseType(Oid typid)
bool type_is_multirange(Oid typid)
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)
FuncExpr * makeFuncExpr(Oid funcid, Oid rettype, List *args, Oid funccollid, Oid inputcollid, CoercionForm fformat)
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)
Node * coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod, CoercionContext ccontext, CoercionForm cformat, int location)
Oid select_common_type(ParseState *pstate, List *exprs, const char *context, Node **which_expr)
bool can_coerce_type(int nargs, const Oid *input_typeids, const Oid *target_typeids, CoercionContext ccontext)
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)
void make_fn_arguments(ParseState *pstate, List *fargs, Oid *actual_arg_types, Oid *declared_arg_types)
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
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)
RTEPermissionInfo * getRTEPermissionInfo(List *rteperminfos, RangeTblEntry *rte)
void markVarForSelectPriv(ParseState *pstate, Var *var)
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 * addRangeTableEntryForRelation(ParseState *pstate, Relation rel, LOCKMODE lockmode, Alias *alias, bool inh, bool inFromCl)
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 ForPortionOfExpr * transformForPortionOfClause(ParseState *pstate, int rtindex, const ForPortionOfClause *forPortionOf, bool isUpdate)
static Node * transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, bool isTopLevel, List **targetlist)
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)
void constructSetOpTargetlist(ParseState *pstate, SetOperationStmt *op, const List *ltargetlist, const List *rtargetlist, List **targetlist, const char *context, bool recursive)
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)
static Query * transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
List * transformUpdateTargetList(ParseState *pstate, List *origTlist, ForPortionOfExpr *forPortionOf)
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 lockStrength
ParseNamespaceColumn * p_nscolumns
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
OnConflictExpr * onConflict
ForPortionOfExpr * forPortionOf
LockClauseStrength strength
LockWaitPolicy waitPolicy
#define FirstLowInvalidHeapAttributeNumber
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
Datum SysCacheGetAttr(SysCacheIdentifier 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)