57 List **res_colnames,
List **res_colvars,
80 Var *l_colvar,
Var *r_colvar);
84 bool lateral_only,
bool lateral_ok);
86 const char *constructName);
96 List *grouplist,
List *targetlist,
int location);
99 Oid rangeopfamily,
Oid rangeopcintype,
Oid *inRangeFunc,
181 bool inh,
bool alsoSource,
AclMode requiredPerms)
192 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
193 errmsg(
"relation \"%s\" cannot be the target of a modifying statement",
215 relation->
alias, inh,
false);
259 List **res_colnames,
List **res_colvars,
274 foreach(lc, *src_colnos)
280 foreach(lc, src_colnames)
291 *res_colvars =
lappend(*res_colvars,
293 src_nscolumns +
attnum - 1));
295 res_nscolumns[colcount] = src_nscolumns[
attnum - 1];
324 forboth(lvars, leftVars, rvars, rightVars)
370 List *save_namespace;
434 r->
alias == NULL ? NULL :
448 elog(
ERROR,
"unexpected non-SELECT command in subquery in FROM");
539 fc->agg_order ==
NIL &&
540 fc->agg_filter == NULL &&
544 !
fc->func_variadic &&
549 foreach(lc2,
fc->args)
568 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
569 errmsg(
"set-returning functions must appear at top level of FROM"),
573 funcexprs =
lappend(funcexprs, newfexpr);
580 coldeflists =
lappend(coldeflists, coldeflist);
596 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
597 errmsg(
"set-returning functions must appear at top level of FROM"),
601 funcexprs =
lappend(funcexprs, newfexpr);
608 (
errcode(ERRCODE_SYNTAX_ERROR),
609 errmsg(
"multiple column definition lists are not allowed for the same function"),
613 coldeflists =
lappend(coldeflists, coldeflist);
641 (
errcode(ERRCODE_SYNTAX_ERROR),
642 errmsg(
"ROWS FROM() with multiple functions cannot have a column definition list"),
643 errhint(
"Put a separate column definition list for each function inside ROWS FROM()."),
648 (
errcode(ERRCODE_SYNTAX_ERROR),
649 errmsg(
"UNNEST() with multiple arguments cannot have a column definition list"),
650 errhint(
"Use separate UNNEST() calls inside ROWS FROM(), and attach a column definition list to each one."),
656 (
errcode(ERRCODE_SYNTAX_ERROR),
657 errmsg(
"WITH ORDINALITY cannot be used with a column definition list"),
658 errhint(
"Put the column definition list inside ROWS FROM()."),
675 funcnames, funcexprs, coldeflists,
676 r, is_lateral,
true);
691 const char *constructName;
703 constructName =
"XMLTABLE";
735 tf->ordinalitycol = -1;
750 tf->colnames =
lappend(tf->colnames,
759 if (tf->ordinalitycol != -1)
761 (
errcode(ERRCODE_SYNTAX_ERROR),
762 errmsg(
"only one FOR ORDINALITY column is allowed"),
767 tf->ordinalitycol = colno;
773 (
errcode(ERRCODE_INVALID_TABLE_DEFINITION),
774 errmsg(
"column \"%s\" cannot be declared SETOF",
783 tf->coltypmods =
lappend_int(tf->coltypmods, typmod);
813 tf->coldefexprs =
lappend(tf->coldefexprs, coldefexpr);
819 for (
j = 0;
j < colno;
j++)
820 if (strcmp(names[
j], rawc->
colname) == 0)
822 (
errcode(ERRCODE_SYNTAX_ERROR),
823 errmsg(
"column name \"%s\" is not unique",
839 bool default_ns_seen =
false;
849 TEXTOID, constructName);
851 ns_uris =
lappend(ns_uris, ns_uri);
856 foreach(lc2, ns_names)
864 (
errcode(ERRCODE_SYNTAX_ERROR),
865 errmsg(
"namespace name \"%s\" is not unique",
874 (
errcode(ERRCODE_SYNTAX_ERROR),
875 errmsg(
"only one default namespace is allowed"),
877 default_ns_seen =
true;
885 tf->ns_uris = ns_uris;
886 tf->ns_names = ns_names;
900 tf, rtf->
alias, is_lateral,
true);
927 funcargtypes[0] = INTERNALOID;
934 (
errcode(ERRCODE_UNDEFINED_OBJECT),
935 errmsg(
"tablesample method %s does not exist",
942 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
943 errmsg(
"function %s must return type %s",
956 (
errcode(ERRCODE_INVALID_TABLESAMPLE_ARGUMENT),
957 errmsg_plural(
"tablesample method %s requires %d argument, not %d",
958 "tablesample method %s requires %d arguments, not %d",
981 tablesample->
args = fargs;
990 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
991 errmsg(
"tablesample method %s does not support REPEATABLE",
1077 *top_nsitem = nsitem;
1078 *
namespace = list_make1(nsitem);
1081 return (
Node *) rtr;
1090 *top_nsitem = nsitem;
1091 *
namespace = list_make1(nsitem);
1094 return (
Node *) rtr;
1103 *top_nsitem = nsitem;
1104 *
namespace = list_make1(nsitem);
1107 return (
Node *) rtr;
1120 *top_nsitem = nsitem;
1121 *
namespace = list_make1(nsitem);
1124 return (
Node *) rtr;
1135 top_nsitem,
namespace);
1136 rte = (*top_nsitem)->p_rte;
1139 (rte->relkind != RELKIND_RELATION &&
1140 rte->relkind != RELKIND_MATVIEW &&
1141 rte->relkind != RELKIND_PARTITIONED_TABLE))
1143 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1144 errmsg(
"TABLESAMPLE clause can only be applied to tables and materialized views"),
1172 int sv_namespace_length;
1208 sv_namespace_length);
1220 my_namespace =
list_concat(l_namespace, r_namespace);
1250 foreach(lx, l_colnames)
1255 if (l_colname[0] ==
'\0')
1258 foreach(rx, r_colnames)
1262 if (strcmp(l_colname, r_colname) == 0)
1271 rlist =
lappend(rlist, m_name);
1274 j->usingClause = rlist;
1281 if (
j->join_using_alias)
1282 j->join_using_alias->colnames =
j->usingClause;
1304 List *ucols =
j->usingClause;
1311 foreach(ucol, ucols)
1321 Assert(u_colname[0] !=
'\0');
1324 foreach(col, res_colnames)
1328 if (strcmp(res_colname, u_colname) == 0)
1330 (
errcode(ERRCODE_DUPLICATE_COLUMN),
1331 errmsg(
"column name \"%s\" appears more than once in USING clause",
1337 foreach(col, l_colnames)
1341 if (strcmp(l_colname, u_colname) == 0)
1345 (
errcode(ERRCODE_AMBIGUOUS_COLUMN),
1346 errmsg(
"common column name \"%s\" appears more than once in left table",
1354 (
errcode(ERRCODE_UNDEFINED_COLUMN),
1355 errmsg(
"column \"%s\" specified in USING clause does not exist in left table",
1361 foreach(col, r_colnames)
1365 if (strcmp(r_colname, u_colname) == 0)
1369 (
errcode(ERRCODE_AMBIGUOUS_COLUMN),
1370 errmsg(
"common column name \"%s\" appears more than once in right table",
1378 (
errcode(ERRCODE_UNDEFINED_COLUMN),
1379 errmsg(
"column \"%s\" specified in USING clause does not exist in right table",
1385 l_usingvars =
lappend(l_usingvars, l_colvar);
1387 r_usingvars =
lappend(r_usingvars, r_colvar);
1432 switch (
j->jointype)
1448 elog(
ERROR,
"unrecognized join type: %d",
1462 forboth(lc1, l_colnos, lc2, r_colnos)
1483 res_colvars =
lappend(res_colvars, u_colvar);
1486 res_nscolumn = res_nscolumns + res_colindex;
1488 if (u_colvar == (
Node *) l_colvar)
1491 *res_nscolumn = l_nscolumns[l_index];
1493 else if (u_colvar == (
Node *) r_colvar)
1496 *res_nscolumn = r_nscolumns[r_index];
1505 res_nscolumn->
p_varno =
j->rtindex;
1519 l_nscolumns, l_colnames, &l_colnos,
1520 &res_colnames, &res_colvars,
1521 res_nscolumns + res_colindex);
1524 r_nscolumns, r_colnames, &r_colnos,
1525 &res_colnames, &res_colvars,
1526 res_nscolumns + res_colindex);
1531 for (k = 0; k < res_colindex; k++)
1551 j->join_using_alias,
1574 if (
j->join_using_alias)
1579 jnsitem->
p_names =
j->join_using_alias;
1592 my_namespace =
lappend(my_namespace, jnsitem);
1606 if (
j->alias != NULL)
1620 *top_nsitem = nsitem;
1621 *
namespace =
lappend(my_namespace, nsitem);
1667 Var *l_colvar,
Var *r_colvar)
1689 if (l_colvar->vartype != outcoltype)
1691 outcoltype, outcoltypmod,
1693 else if (l_colvar->vartypmod != outcoltypmod)
1695 outcoltype, outcoltypmod,
1699 l_node = (
Node *) l_colvar;
1701 if (r_colvar->vartype != outcoltype)
1703 outcoltype, outcoltypmod,
1705 else if (r_colvar->vartypmod != outcoltypmod)
1707 outcoltype, outcoltypmod,
1711 r_node = (
Node *) r_colvar;
1725 else if (
IsA(r_node,
Var))
1746 c->coalescetype = outcoltype;
1750 res_node = (
Node *)
c;
1754 elog(
ERROR,
"unrecognized join type: %d", (
int) jointype);
1819 foreach(lc,
namespace)
1836 foreach(lc,
namespace)
1906 (
errcode(ERRCODE_INVALID_ROW_COUNT_IN_LIMIT_CLAUSE),
1907 errmsg(
"row count cannot be null in FETCH FIRST ... WITH TIES clause")));
1930 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
1932 errmsg(
"argument of %s must not contain variables",
1960 (
errcode(ERRCODE_GROUPING_ERROR),
1962 errmsg(
"aggregate functions are not allowed in %s",
1969 (
errcode(ERRCODE_WINDOWING_ERROR),
1971 errmsg(
"window functions are not allowed in %s",
1983 elog(
ERROR,
"unexpected exprKind in checkTargetlistEntrySQL92");
2054 int location = ((
ColumnRef *) node)->location;
2086 if (!tle->resjunk &&
2087 strcmp(tle->resname,
name) == 0)
2089 if (target_result != NULL)
2093 (
errcode(ERRCODE_AMBIGUOUS_COLUMN),
2097 errmsg(
"%s \"%s\" is ambiguous",
2103 target_result = tle;
2107 if (target_result != NULL)
2111 return target_result;
2118 int targetlist_pos = 0;
2123 (
errcode(ERRCODE_SYNTAX_ERROR),
2125 errmsg(
"non-integer constant in %s",
2136 if (++targetlist_pos == target_pos)
2145 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2147 errmsg(
"%s position %d is not in select list",
2204 if (
equal(expr, texpr))
2216 *tlist =
lappend(*tlist, target_result);
2218 return target_result;
2283 if (hasGroupingSets)
2284 *hasGroupingSets =
true;
2304 result_set =
lappend(result_set, n2);
2318 return (
Node *) result_set;
2325 foreach(l, (
List *) expr)
2338 return (
Node *) result;
2369 List **targetlist,
List *sortClause,
2377 targetlist, exprKind);
2380 targetlist, exprKind);
2424 foreach(sl, sortClause)
2434 *flatresult =
lappend(*flatresult, grpc);
2447 *flatresult, *targetlist,
2477 List **targetlist,
List *sortClause,
2530 List **targetlist,
List *sortClause,
2546 targetlist, sortClause,
2547 exprKind, useSQL99,
false);
2559 targetlist, sortClause,
2560 exprKind, useSQL99,
false));
2585 (
errcode(ERRCODE_TOO_MANY_COLUMNS),
2586 errmsg(
"CUBE is limited to 12 elements"),
2633 List **targetlist,
List *sortClause,
2637 List *flat_grouplist;
2640 bool hasGroupingSets =
false;
2658 if (flat_grouplist ==
NIL && hasGroupingSets)
2665 foreach(gl, flat_grouplist)
2688 targetlist, sortClause,
2689 exprKind, useSQL99,
true));
2697 targetlist, sortClause,
2698 exprKind, useSQL99,
true);
2703 if (hasGroupingSets)
2713 Assert(gsets ==
NIL || groupingSets != NULL);
2716 *groupingSets = gsets;
2741 foreach(olitem, orderlist)
2748 targetlist, exprKind);
2751 targetlist, exprKind);
2754 sortlist, *targetlist, sortby);
2773 foreach(lc, windowdefs)
2777 List *partitionClause;
2791 (
errcode(ERRCODE_WINDOWING_ERROR),
2792 errmsg(
"window \"%s\" is already defined", windef->
name),
2803 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2804 errmsg(
"window \"%s\" does not exist",
2831 wc->name = windef->
name;
2832 wc->refname = windef->
refname;
2850 if (partitionClause)
2852 (
errcode(ERRCODE_WINDOWING_ERROR),
2853 errmsg(
"cannot override PARTITION BY clause of window \"%s\"",
2864 (
errcode(ERRCODE_WINDOWING_ERROR),
2865 errmsg(
"cannot override ORDER BY clause of window \"%s\"",
2871 wc->copiedOrder =
false;
2876 wc->copiedOrder =
true;
2882 wc->copiedOrder =
false;
2894 (
errcode(ERRCODE_WINDOWING_ERROR),
2895 errmsg(
"cannot copy window \"%s\" because it has a frame clause",
2900 (
errcode(ERRCODE_WINDOWING_ERROR),
2901 errmsg(
"cannot copy window \"%s\" because it has a frame clause",
2903 errhint(
"Omit the parentheses in this OVER clause."),
2918 int16 rangestrategy;
2922 (
errcode(ERRCODE_WINDOWING_ERROR),
2923 errmsg(
"RANGE with offset PRECEDING/FOLLOWING requires exactly one ORDER BY column"),
2932 elog(
ERROR,
"operator %u is not a valid ordering operator",
2945 (
errcode(ERRCODE_WINDOWING_ERROR),
2946 errmsg(
"GROUPS mode requires an ORDER BY clause"),
2952 rangeopfamily, rangeopcintype,
2953 &wc->startInRangeFunc,
2956 rangeopfamily, rangeopcintype,
2957 &wc->endInRangeFunc,
2986 List **targetlist,
List *sortClause,
bool is_agg)
3007 foreach(slitem, sortClause)
3014 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
3016 errmsg(
"in an aggregate with DISTINCT, ORDER BY expressions must appear in argument list") :
3017 errmsg(
"for SELECT DISTINCT, ORDER BY expressions must appear in select list"),
3027 foreach(tlitem, *targetlist)
3034 result, *targetlist,
3047 (
errcode(ERRCODE_SYNTAX_ERROR),
3049 errmsg(
"an aggregate with DISTINCT must have at least one argument") :
3050 errmsg(
"SELECT DISTINCT must have at least one column")));
3070 List **targetlist,
List *sortClause)
3074 bool skipped_sortitem;
3086 foreach(lc, distinctlist)
3095 sortgrouprefs =
lappend_int(sortgrouprefs, sortgroupref);
3106 skipped_sortitem =
false;
3107 foreach(lc, sortClause)
3113 if (skipped_sortitem)
3115 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
3116 errmsg(
"SELECT DISTINCT ON expressions must match initial ORDER BY expressions"),
3125 skipped_sortitem =
true;
3137 forboth(lc, distinctlist, lc2, sortgrouprefs)
3145 if (skipped_sortitem)
3147 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
3148 errmsg(
"SELECT DISTINCT ON expressions must match initial ORDER BY expressions"),
3151 result, *targetlist,
3181 forboth(lcs, sortgrouprefs, lce, exprs)
3187 elog(
ERROR,
"get_matching_location: no matching sortgroupref");
3225 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
3226 errmsg(
"ASC/DESC is not allowed in ON CONFLICT clause"),
3231 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
3232 errmsg(
"NULLS FIRST/LAST is not allowed in ON CONFLICT clause"),
3282 result =
lappend(result, pInfer);
3299 List **arbiterExpr,
Node **arbiterWhere,
3305 *arbiterWhere = NULL;
3310 (
errcode(ERRCODE_SYNTAX_ERROR),
3311 errmsg(
"ON CONFLICT DO UPDATE requires inference specification or constraint name"),
3312 errhint(
"For example, ON CONFLICT (column_name)."),
3322 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3323 errmsg(
"ON CONFLICT is not supported with system catalog tables"),
3330 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3331 errmsg(
"ON CONFLICT is not supported on table \"%s\" used as a catalog table",
3405 if (restype == UNKNOWNOID)
3408 restype, TEXTOID, -1,
3435 &sortop, &eqop, NULL,
3442 NULL, &eqop, &sortop,
3461 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3462 errmsg(
"operator %s is not a valid ordering operator",
3464 errhint(
"Ordering operators must be \"<\" or \">\" members of btree operator families.")));
3489 sortcl->
eqop = eqop;
3491 sortcl->hashable = hashable;
3506 elog(
ERROR,
"unrecognized sortby_nulls: %d",
3511 sortlist =
lappend(sortlist, sortcl);
3537 List *grouplist,
List *targetlist,
int location)
3542 if (restype == UNKNOWNOID)
3545 restype, TEXTOID, -1,
3566 &sortop, &eqop, NULL,
3575 grpcl->hashable = hashable;
3577 grouplist =
lappend(grouplist, grpcl);
3641 foreach(l, sortList)
3667 if (wc->name && strcmp(wc->name,
name) == 0)
3687 Oid rangeopfamily,
Oid rangeopcintype,
Oid *inRangeFunc,
3690 const char *constructName = NULL;
3707 constructName =
"ROWS";
3736 preferredType = (nodeType != UNKNOWNOID) ? nodeType : rangeopcintype;
3759 if (selectedType != preferredType)
3761 selectedType = procform->amprocrighttype;
3762 selectedFunc = procform->amproc;
3774 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3775 errmsg(
"RANGE with offset PRECEDING/FOLLOWING is not supported for column type %s",
3780 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3781 errmsg(
"RANGE with offset PRECEDING/FOLLOWING is not supported for column type %s and offset type %s",
3784 errhint(
"Cast the offset value to an appropriate type."),
3786 if (nmatches != 1 && selectedType != preferredType)
3788 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3789 errmsg(
"RANGE with offset PRECEDING/FOLLOWING has multiple interpretations for column type %s and offset type %s",
3792 errhint(
"Cast the offset value to the exact intended type."),
3796 constructName =
"RANGE";
3798 selectedType, constructName);
3799 *inRangeFunc = selectedFunc;
3809 constructName =
"GROUPS";
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_add_member(Bitmapset *a, int x)
Bitmapset * bms_add_members(Bitmapset *a, const Bitmapset *b)
#define Assert(condition)
#define OidIsValid(objectId)
bool IsCatalogRelation(Relation relation)
void ReleaseCatCacheList(CatCList *list)
int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
bool equal(const void *a, const void *b)
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)
bool list_member_int(const List *list, int datum)
List * list_concat(List *list1, const List *list2)
Oid get_equality_op_for_ordering_op(Oid opno, bool *reverse)
bool op_hashjoinable(Oid opno, Oid inputtype)
Oid get_typcollation(Oid typid)
bool get_ordering_op_properties(Oid opno, Oid *opfamily, Oid *opcintype, int16 *strategy)
Oid get_func_rettype(Oid funcid)
Oid get_commutator(Oid opno)
RelabelType * makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod, Oid rcollid, CoercionForm rformat)
GroupingSet * makeGroupingSet(GroupingSetKind kind, List *content, int location)
Var * makeVar(int varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
Expr * makeBoolExpr(BoolExprType boolop, List *args, int location)
FuncCall * makeFuncCall(List *name, List *args, CoercionForm funcformat, int location)
A_Expr * makeSimpleA_Expr(A_Expr_Kind kind, char *name, Node *lexpr, Node *rexpr, int location)
char * pstrdup(const char *in)
void pfree(void *pointer)
void * palloc0(Size size)
char * NameListToString(const List *names)
Oid exprType(const Node *expr)
int32 exprTypmod(const Node *expr)
Oid exprCollation(const Node *expr)
int exprLocation(const Node *expr)
Node * strip_implicit_coercions(Node *node)
#define IsA(nodeptr, _type_)
#define castNode(_type_, nodeptr)
Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok)
Index assignSortGroupRef(TargetEntry *tle, List *tlist)
static Node * transformJoinOnClause(ParseState *pstate, JoinExpr *j, List *namespace)
static int extractRemainingColumns(ParseState *pstate, ParseNamespaceColumn *src_nscolumns, List *src_colnames, List **src_colnos, List **res_colnames, List **res_colvars, ParseNamespaceColumn *res_nscolumns)
static void setNamespaceLateralState(List *namespace, bool lateral_only, bool lateral_ok)
List * transformWindowDefinitions(ParseState *pstate, List *windowdefs, List **targetlist)
List * addTargetToSortList(ParseState *pstate, TargetEntry *tle, List *sortlist, List *targetlist, SortBy *sortby)
static void markRelsAsNulledBy(ParseState *pstate, Node *n, int jindex)
static void checkExprIsVarFree(ParseState *pstate, Node *n, const char *constructName)
List * transformDistinctOnClause(ParseState *pstate, List *distinctlist, List **targetlist, List *sortClause)
static ParseNamespaceItem * transformRangeSubselect(ParseState *pstate, RangeSubselect *r)
Node * transformLimitClause(ParseState *pstate, Node *clause, ParseExprKind exprKind, const char *constructName, LimitOption limitOption)
static List * transformGroupClauseList(List **flatresult, ParseState *pstate, List *list, List **targetlist, List *sortClause, ParseExprKind exprKind, bool useSQL99, bool toplevel)
List * transformSortClause(ParseState *pstate, List *orderlist, List **targetlist, ParseExprKind exprKind, bool useSQL99)
static Node * transformGroupingSet(List **flatresult, ParseState *pstate, GroupingSet *gset, List **targetlist, List *sortClause, ParseExprKind exprKind, bool useSQL99, bool toplevel)
static Node * flatten_grouping_sets(Node *expr, bool toplevel, bool *hasGroupingSets)
Node * transformWhereClause(ParseState *pstate, Node *clause, ParseExprKind exprKind, const char *constructName)
static Var * buildVarFromNSColumn(ParseState *pstate, ParseNamespaceColumn *nscol)
static ParseNamespaceItem * transformRangeTableFunc(ParseState *pstate, RangeTableFunc *rtf)
static void setNamespaceColumnVisibility(List *namespace, bool cols_visible)
static int get_matching_location(int sortgroupref, List *sortgrouprefs, List *exprs)
void transformFromClause(ParseState *pstate, List *frmList)
static ParseNamespaceItem * getNSItemForSpecialRelationTypes(ParseState *pstate, RangeVar *rv)
static void checkTargetlistEntrySQL92(ParseState *pstate, TargetEntry *tle, ParseExprKind exprKind)
List * transformGroupClause(ParseState *pstate, List *grouplist, List **groupingSets, List **targetlist, List *sortClause, ParseExprKind exprKind, bool useSQL99)
static Index transformGroupClauseExpr(List **flatresult, Bitmapset *seen_local, ParseState *pstate, Node *gexpr, List **targetlist, List *sortClause, ParseExprKind exprKind, bool useSQL99, bool toplevel)
List * transformDistinctClause(ParseState *pstate, List **targetlist, List *sortClause, bool is_agg)
static TableSampleClause * transformRangeTableSample(ParseState *pstate, RangeTableSample *rts)
static TargetEntry * findTargetlistEntrySQL99(ParseState *pstate, Node *node, List **tlist, ParseExprKind exprKind)
bool targetIsInSortList(TargetEntry *tle, Oid sortop, List *sortList)
static List * addTargetToGroupList(ParseState *pstate, TargetEntry *tle, List *grouplist, List *targetlist, int location)
static Node * transformFrameOffset(ParseState *pstate, int frameOptions, Oid rangeopfamily, Oid rangeopcintype, Oid *inRangeFunc, Node *clause)
static List * resolve_unique_index_expr(ParseState *pstate, InferClause *infer, Relation heapRel)
void transformOnConflictArbiter(ParseState *pstate, OnConflictClause *onConflictClause, List **arbiterExpr, Node **arbiterWhere, Oid *constraint)
static Node * transformJoinUsingClause(ParseState *pstate, List *leftVars, List *rightVars)
int setTargetTable(ParseState *pstate, RangeVar *relation, bool inh, bool alsoSource, AclMode requiredPerms)
static Node * buildMergedJoinVar(ParseState *pstate, JoinType jointype, Var *l_colvar, Var *r_colvar)
static Node * transformFromClauseItem(ParseState *pstate, Node *n, ParseNamespaceItem **top_nsitem, List **namespace)
static ParseNamespaceItem * transformTableEntry(ParseState *pstate, RangeVar *r)
static TargetEntry * findTargetlistEntrySQL92(ParseState *pstate, Node *node, List **tlist, ParseExprKind exprKind)
static WindowClause * findWindowClause(List *wclist, const char *name)
static ParseNamespaceItem * transformRangeFunction(ParseState *pstate, RangeFunction *r)
Node * coerce_to_specific_type_typmod(ParseState *pstate, Node *node, Oid targetTypeId, int32 targetTypmod, const char *constructName)
Node * coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod, CoercionContext ccontext, CoercionForm cformat, int location)
Node * coerce_to_boolean(ParseState *pstate, Node *node, const char *constructName)
int32 select_common_typmod(ParseState *pstate, List *exprs, Oid common_type)
Node * coerce_to_specific_type(ParseState *pstate, Node *node, Oid targetTypeId, const char *constructName)
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)
void assign_list_collations(ParseState *pstate, List *exprs)
void assign_expr_collations(ParseState *pstate, Node *expr)
Node * transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind)
const char * ParseExprKindName(ParseExprKind exprKind)
Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes, bool missing_ok)
ParseNamespaceItem * transformJsonTable(ParseState *pstate, JsonTable *jt)
void cancel_parser_errposition_callback(ParseCallbackState *pcbstate)
int parser_errposition(ParseState *pstate, int location)
void setup_parser_errposition_callback(ParseCallbackState *pcbstate, ParseState *pstate, int location)
@ EXPR_KIND_INDEX_EXPRESSION
@ EXPR_KIND_WINDOW_FRAME_RANGE
@ EXPR_KIND_FROM_SUBSELECT
@ EXPR_KIND_WINDOW_FRAME_GROUPS
@ EXPR_KIND_INDEX_PREDICATE
@ EXPR_KIND_FROM_FUNCTION
@ EXPR_KIND_WINDOW_PARTITION
@ EXPR_KIND_WINDOW_FRAME_ROWS
struct ParseNamespaceColumn ParseNamespaceColumn
void get_sort_group_operators(Oid argtype, bool needLT, bool needEQ, bool needGT, Oid *ltOpr, Oid *eqOpr, Oid *gtOpr, bool *isHashable)
Oid compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError)
void markNullableIfNeeded(ParseState *pstate, Var *var)
ParseNamespaceItem * addRangeTableEntryForCTE(ParseState *pstate, CommonTableExpr *cte, Index levelsup, RangeVar *rv, bool inFromCl)
ParseNamespaceItem * addRangeTableEntry(ParseState *pstate, RangeVar *relation, Alias *alias, bool inh, 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)
void markVarForSelectPriv(ParseState *pstate, Var *var)
CommonTableExpr * scanNameSpaceForCTE(ParseState *pstate, const char *refname, Index *ctelevelsup)
ParseNamespaceItem * addRangeTableEntryForRelation(ParseState *pstate, Relation rel, int lockmode, Alias *alias, bool inh, bool inFromCl)
Relation parserOpenTable(ParseState *pstate, const RangeVar *relation, int lockmode)
void addNSItemToQuery(ParseState *pstate, ParseNamespaceItem *nsitem, bool addToJoinList, bool addToRelNameSpace, bool addToVarNameSpace)
ParseNamespaceItem * addRangeTableEntryForSubquery(ParseState *pstate, Query *subquery, Alias *alias, bool lateral, bool inFromCl)
bool scanNameSpaceForENR(ParseState *pstate, const char *refname)
bool isLockedRefname(ParseState *pstate, const char *refname)
ParseNamespaceItem * addRangeTableEntryForFunction(ParseState *pstate, List *funcnames, List *funcexprs, List *coldeflists, RangeFunction *rangefunc, bool lateral, bool inFromCl)
Node * colNameToVar(ParseState *pstate, const char *colname, bool localonly, int location)
ParseNamespaceItem * addRangeTableEntryForTableFunc(ParseState *pstate, TableFunc *tf, Alias *alias, bool lateral, bool inFromCl)
ParseNamespaceItem * addRangeTableEntryForENR(ParseState *pstate, RangeVar *rv, bool inFromCl)
void checkNameSpaceConflicts(ParseState *pstate, List *namespace1, List *namespace2)
TargetEntry * transformTargetEntry(ParseState *pstate, Node *node, Node *expr, ParseExprKind exprKind, char *colname, bool resjunk)
char * FigureColname(Node *node)
Oid LookupCollation(ParseState *pstate, List *collnames, int location)
void typenameTypeIdAndMod(ParseState *pstate, const TypeName *typeName, Oid *typeid_p, int32 *typmod_p)
#define FRAMEOPTION_END_OFFSET
#define FRAMEOPTION_START_OFFSET
#define FRAMEOPTION_RANGE
#define FRAMEOPTION_GROUPS
#define FRAMEOPTION_DEFAULTS
Query * parse_sub_analyze(Node *parseTree, ParseState *parentParseState, CommonTableExpr *parentCTE, bool locked_from_parent, bool resolve_unknowns)
List * SystemFuncName(char *name)
FormData_pg_amproc * Form_pg_amproc
Bitmapset * get_relation_constraint_attnos(Oid relid, const char *conname, bool missing_ok, Oid *constraintOid)
#define lfirst_node(type, lc)
static int list_length(const List *l)
#define linitial_node(type, l)
#define forboth(cell1, list1, cell2, list2)
static ListCell * list_nth_cell(const List *list, int n)
#define list_make1_int(x1)
#define list_make2(x1, x2)
void check_stack_depth(void)
static Datum ObjectIdGetDatum(Oid X)
static int fc(const char *x)
static struct subre * parse(struct vars *v, int stopper, int type, struct state *init, struct state *final)
#define RelationGetRelid(relation)
#define RelationIsUsedAsCatalogTable(relation)
#define RelationGetRelationName(relation)
bool contain_windowfuncs(Node *node)
int locate_agg_of_level(Node *node, int levelsup)
bool contain_aggs_of_level(Node *node, int levelsup)
int locate_windowfunc(Node *node)
#define BTLessStrategyNumber
SortByNulls nulls_ordering
ParseNamespaceColumn * p_nscolumns
RTEPermissionInfo * p_perminfo
ParseNamespaceItem * p_target_nsitem
ParseExprKind p_expr_kind
Relation p_target_relation
struct TableSampleClause * tablesample
bool repeatable_across_queries
CatCTup * members[FLEXIBLE_ARRAY_MEMBER]
#define SearchSysCacheList2(cacheId, key1, key2)
void table_close(Relation relation, LOCKMODE lockmode)
TsmRoutine * GetTsmRoutine(Oid tsmhandler)
TargetEntry * get_sortgroupref_tle(Index sortref, List *targetList)
Node * get_sortgroupclause_expr(SortGroupClause *sgClause, List *targetList)
TargetEntry * get_sortgroupclause_tle(SortGroupClause *sgClause, List *targetList)
String * makeString(char *str)
bool contain_vars_of_level(Node *node, int levelsup)
int locate_var_of_level(Node *node, int levelsup)