51 #define makeDefaultNSItem(rte) makeNamespaceItem(rte, true, true, false, true)
54 List *src_colnames,
List *src_colvars,
55 List **res_colnames,
List **res_colvars);
74 Var *l_colvar,
Var *r_colvar);
76 bool rel_visible,
bool cols_visible,
77 bool lateral_only,
bool lateral_ok);
80 bool lateral_only,
bool lateral_ok);
82 const char *constructName);
92 List *grouplist,
List *targetlist,
int location,
177 bool inh,
bool alsoSource,
AclMode requiredPerms)
200 relation->
alias, inh,
false);
251 elog(
ERROR,
"bogus InhOption value: %d", inhOpt);
271 foreach(cell, defList)
280 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
281 errmsg(
"unrecognized parameter \"%s\"",
300 List *src_colnames,
List *src_colvars,
301 List **res_colnames,
List **res_colvars)
310 forboth(lnames, src_colnames, lvars, src_colvars)
316 foreach(cnames, common_colnames)
320 if (strcmp(colname, ccolname) == 0)
334 *res_colnames = new_colnames;
335 *res_colvars = new_colvars;
361 forboth(lvars, leftVars, rvars, rightVars)
407 List *save_namespace;
477 elog(
ERROR,
"subquery in FROM must have an alias");
512 elog(
ERROR,
"unexpected non-SELECT command in subquery in FROM");
614 foreach(lc, fc->
args)
632 coldeflists =
lappend(coldeflists, coldeflist);
648 (
errcode(ERRCODE_SYNTAX_ERROR),
649 errmsg(
"multiple column definition lists are not allowed for the same function"),
653 coldeflists =
lappend(coldeflists, coldeflist);
681 (
errcode(ERRCODE_SYNTAX_ERROR),
682 errmsg(
"ROWS FROM() with multiple functions cannot have a column definition list"),
683 errhint(
"Put a separate column definition list for each function inside ROWS FROM()."),
688 (
errcode(ERRCODE_SYNTAX_ERROR),
689 errmsg(
"UNNEST() with multiple arguments cannot have a column definition list"),
690 errhint(
"Use separate UNNEST() calls inside ROWS FROM(), and attach a column definition list to each one."),
696 (
errcode(ERRCODE_SYNTAX_ERROR),
697 errmsg(
"WITH ORDINALITY cannot be used with a column definition list"),
698 errhint(
"Put the column definition list inside ROWS FROM()."),
715 funcnames, funcexprs, coldeflists,
716 r, is_lateral,
true);
752 (
errcode(ERRCODE_UNDEFINED_OBJECT),
753 errmsg(
"tablesample method %s does not exist",
760 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
761 errmsg(
"function %s must return type %s",
774 (
errcode(ERRCODE_INVALID_TABLESAMPLE_ARGUMENT),
775 errmsg_plural(
"tablesample method %s requires %d argument, not %d",
776 "tablesample method %s requires %d arguments, not %d",
799 tablesample->
args = fargs;
808 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
809 errmsg(
"tablesample method %s does not support REPEATABLE",
879 *
namespace =
list_make1(makeDefaultNSItem(rte));
897 *
namespace =
list_make1(makeDefaultNSItem(rte));
915 *
namespace =
list_make1(makeDefaultNSItem(rte));
930 top_rte, top_rti,
namespace);
939 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
940 errmsg(
"TABLESAMPLE clause can only be applied to tables and materialized views"),
965 int sv_namespace_length;
1007 sv_namespace_length);
1019 my_namespace =
list_concat(l_namespace, r_namespace);
1026 expandRTE(l_rte, l_rtindex, 0, -1,
false,
1027 &l_colnames, &l_colvars);
1028 expandRTE(r_rte, r_rtindex, 0, -1,
false,
1029 &r_colnames, &r_colvars);
1048 foreach(lx, l_colnames)
1053 foreach(rx, r_colnames)
1057 if (strcmp(l_colname, r_colname) == 0)
1066 rlist =
lappend(rlist, m_name);
1092 foreach(ucol, ucols)
1103 foreach(col, res_colnames)
1107 if (strcmp(res_colname, u_colname) == 0)
1109 (
errcode(ERRCODE_DUPLICATE_COLUMN),
1110 errmsg(
"column name \"%s\" appears more than once in USING clause",
1116 foreach(col, l_colnames)
1120 if (strcmp(l_colname, u_colname) == 0)
1124 (
errcode(ERRCODE_AMBIGUOUS_COLUMN),
1125 errmsg(
"common column name \"%s\" appears more than once in left table",
1133 (
errcode(ERRCODE_UNDEFINED_COLUMN),
1134 errmsg(
"column \"%s\" specified in USING clause does not exist in left table",
1139 foreach(col, r_colnames)
1143 if (strcmp(r_colname, u_colname) == 0)
1147 (
errcode(ERRCODE_AMBIGUOUS_COLUMN),
1148 errmsg(
"common column name \"%s\" appears more than once in right table",
1156 (
errcode(ERRCODE_UNDEFINED_COLUMN),
1157 errmsg(
"column \"%s\" specified in USING clause does not exist in right table",
1160 l_colvar =
list_nth(l_colvars, l_index);
1161 l_usingvars =
lappend(l_usingvars, l_colvar);
1162 r_colvar =
list_nth(r_colvars, r_index);
1163 r_usingvars =
lappend(r_usingvars, r_colvar);
1166 res_colvars =
lappend(res_colvars,
1191 l_colnames, l_colvars,
1192 &l_colnames, &l_colvars);
1194 r_colnames, r_colvars,
1195 &r_colnames, &r_colvars);
1196 res_colnames =
list_concat(res_colnames, l_colnames);
1197 res_colvars =
list_concat(res_colvars, l_colvars);
1198 res_colnames =
list_concat(res_colnames, r_colnames);
1199 res_colvars =
list_concat(res_colvars, r_colvars);
1210 (
errcode(ERRCODE_SYNTAX_ERROR),
1211 errmsg(
"column alias list for \"%s\" has too many entries",
1259 *
namespace =
lappend(my_namespace,
1260 makeNamespaceItem(rte,
1279 Var *l_colvar,
Var *r_colvar)
1290 outcoltype = l_colvar->
vartype;
1292 if (outcoltype != r_colvar->
vartype)
1300 else if (outcoltypmod != r_colvar->
vartypmod)
1312 if (l_colvar->
vartype != outcoltype)
1314 outcoltype, outcoltypmod,
1316 else if (l_colvar->
vartypmod != outcoltypmod)
1318 outcoltype, outcoltypmod,
1322 l_node = (
Node *) l_colvar;
1324 if (r_colvar->
vartype != outcoltype)
1326 outcoltype, outcoltypmod,
1328 else if (r_colvar->
vartypmod != outcoltypmod)
1330 outcoltype, outcoltypmod,
1334 r_node = (
Node *) r_colvar;
1348 else if (
IsA(r_node,
Var))
1373 res_node = (
Node *) c;
1377 elog(
ERROR,
"unrecognized join type: %d", (
int) jointype);
1398 bool lateral_only,
bool lateral_ok)
1403 nsitem->
p_rte = rte;
1420 foreach(lc,
namespace)
1437 foreach(lc,
namespace)
1518 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
1520 errmsg(
"argument of %s must not contain variables",
1548 (
errcode(ERRCODE_GROUPING_ERROR),
1550 errmsg(
"aggregate functions are not allowed in %s",
1557 (
errcode(ERRCODE_WINDOWING_ERROR),
1559 errmsg(
"window functions are not allowed in %s",
1571 elog(
ERROR,
"unexpected exprKind in checkTargetlistEntrySQL92");
1642 int location = ((
ColumnRef *) node)->location;
1675 strcmp(tle->
resname, name) == 0)
1677 if (target_result !=
NULL)
1681 (
errcode(ERRCODE_AMBIGUOUS_COLUMN),
1685 errmsg(
"%s \"%s\" is ambiguous",
1691 target_result = tle;
1695 if (target_result !=
NULL)
1699 return target_result;
1706 int location = ((
A_Const *) node)->location;
1707 int targetlist_pos = 0;
1710 if (!
IsA(val, Integer))
1712 (
errcode(ERRCODE_SYNTAX_ERROR),
1714 errmsg(
"non-integer constant in %s",
1718 target_pos =
intVal(val);
1725 if (++targetlist_pos == target_pos)
1734 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
1736 errmsg(
"%s position %d is not in select list",
1793 if (
equal(expr, texpr))
1805 *tlist =
lappend(*tlist, target_result);
1807 return target_result;
1872 if (hasGroupingSets)
1873 *hasGroupingSets =
true;
1895 result_set =
lappend(result_set, n2);
1909 return (
Node *) result_set;
1916 foreach(l, (
List *) expr)
1929 return (
Node *) result;
1960 List **targetlist,
List *sortClause,
1968 targetlist, exprKind);
1971 targetlist, exprKind);
2015 foreach(sl, sortClause)
2025 *flatresult =
lappend(*flatresult, grpc);
2038 *flatresult, *targetlist,
2069 List **targetlist,
List *sortClause,
2122 List **targetlist,
List *sortClause,
2138 targetlist, sortClause,
2139 exprKind, useSQL99,
false);
2151 targetlist, sortClause,
2152 exprKind, useSQL99,
false));
2177 (
errcode(ERRCODE_TOO_MANY_COLUMNS),
2178 errmsg(
"CUBE is limited to 12 elements"),
2225 List **targetlist,
List *sortClause,
2229 List *flat_grouplist;
2232 bool hasGroupingSets =
false;
2250 if (flat_grouplist ==
NIL && hasGroupingSets)
2257 foreach(gl, flat_grouplist)
2280 targetlist, sortClause,
2281 exprKind, useSQL99,
true));
2289 targetlist, sortClause,
2290 exprKind, useSQL99,
true);
2295 if (hasGroupingSets)
2308 *groupingSets = gsets;
2328 bool resolveUnknown,
2334 foreach(olitem, orderlist)
2341 targetlist, exprKind);
2344 targetlist, exprKind);
2347 sortlist, *targetlist, sortby,
2367 foreach(lc, windowdefs)
2371 List *partitionClause;
2383 (
errcode(ERRCODE_WINDOWING_ERROR),
2384 errmsg(
"window \"%s\" is already defined", windef->
name),
2395 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2396 errmsg(
"window \"%s\" does not exist",
2443 if (partitionClause)
2445 (
errcode(ERRCODE_WINDOWING_ERROR),
2446 errmsg(
"cannot override PARTITION BY clause of window \"%s\"",
2457 (
errcode(ERRCODE_WINDOWING_ERROR),
2458 errmsg(
"cannot override ORDER BY clause of window \"%s\"",
2487 (
errcode(ERRCODE_WINDOWING_ERROR),
2488 errmsg(
"cannot copy window \"%s\" because it has a frame clause",
2493 (
errcode(ERRCODE_WINDOWING_ERROR),
2494 errmsg(
"cannot copy window \"%s\" because it has a frame clause",
2496 errhint(
"Omit the parentheses in this OVER clause."),
2532 List **targetlist,
List *sortClause,
bool is_agg)
2553 foreach(slitem, sortClause)
2560 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2562 errmsg(
"in an aggregate with DISTINCT, ORDER BY expressions must appear in argument list") :
2563 errmsg(
"for SELECT DISTINCT, ORDER BY expressions must appear in select list"),
2573 foreach(tlitem, *targetlist)
2580 result, *targetlist,
2594 (
errcode(ERRCODE_SYNTAX_ERROR),
2596 errmsg(
"an aggregate with DISTINCT must have at least one argument") :
2597 errmsg(
"SELECT DISTINCT must have at least one column")));
2617 List **targetlist,
List *sortClause)
2621 bool skipped_sortitem;
2633 foreach(lc, distinctlist)
2642 sortgrouprefs =
lappend_int(sortgrouprefs, sortgroupref);
2653 skipped_sortitem =
false;
2654 foreach(lc, sortClause)
2660 if (skipped_sortitem)
2662 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2663 errmsg(
"SELECT DISTINCT ON expressions must match initial ORDER BY expressions"),
2672 skipped_sortitem =
true;
2684 forboth(lc, distinctlist, lc2, sortgrouprefs)
2692 if (skipped_sortitem)
2694 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2695 errmsg(
"SELECT DISTINCT ON expressions must match initial ORDER BY expressions"),
2698 result, *targetlist,
2729 forboth(lcs, sortgrouprefs, lce, exprs)
2735 elog(
ERROR,
"get_matching_location: no matching sortgroupref");
2773 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2774 errmsg(
"ASC/DESC is not allowed in ON CONFLICT clause"),
2779 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2780 errmsg(
"NULLS FIRST/LAST is not allowed in ON CONFLICT clause"),
2831 result =
lappend(result, pInfer);
2848 List **arbiterExpr,
Node **arbiterWhere,
2854 *arbiterWhere =
NULL;
2859 (
errcode(ERRCODE_SYNTAX_ERROR),
2860 errmsg(
"ON CONFLICT DO UPDATE requires inference specification or constraint name"),
2861 errhint(
"For example, ON CONFLICT (column_name)."),
2871 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2872 errmsg(
"ON CONFLICT is not supported with system catalog tables"),
2879 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2880 errmsg(
"ON CONFLICT is not supported on table \"%s\" used as a catalog table",
2888 List *save_namespace;
2897 false,
false,
true);
2944 bool resolveUnknown)
2985 &sortop, &eqop,
NULL,
2992 NULL, &eqop, &sortop,
3011 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3012 errmsg(
"operator %s is not a valid ordering operator",
3014 errhint(
"Ordering operators must be \"<\" or \">\" members of btree operator families.")));
3039 sortcl->
eqop = eqop;
3056 elog(
ERROR,
"unrecognized sortby_nulls: %d",
3061 sortlist =
lappend(sortlist, sortcl);
3092 List *grouplist,
List *targetlist,
int location,
3093 bool resolveUnknown)
3122 &sortop, &eqop,
NULL,
3133 grouplist =
lappend(grouplist, grpcl);
3197 foreach(l, sortList)
3223 if (wc->
name && strcmp(wc->
name, name) == 0)
3237 const char *constructName =
NULL;
3252 constructName =
"ROWS";
3264 constructName =
"RANGE";
3266 elog(
ERROR,
"window frame with value offset is not implemented");
#define list_make2(x1, x2)
Value * makeString(char *str)
static void checkExprIsVarFree(ParseState *pstate, Node *n, const char *constructName)
bool IsCatalogRelation(Relation relation)
List * SystemFuncName(char *name)
Index assignSortGroupRef(TargetEntry *tle, List *tlist)
#define IsA(nodeptr, _type_)
bool repeatable_across_queries
Oid get_commutator(Oid opno)
TargetEntry * get_sortgroupclause_tle(SortGroupClause *sgClause, List *targetList)
int errhint(const char *fmt,...)
#define FRAMEOPTION_DEFAULTS
#define forboth(cell1, list1, cell2, list2)
List * transformDistinctOnClause(ParseState *pstate, List *distinctlist, List **targetlist, List *sortClause)
int exprLocation(const Node *expr)
RangeTblEntry * addRangeTableEntryForJoin(ParseState *pstate, List *colnames, JoinType jointype, List *aliasvars, Alias *alias, bool inFromCl)
bool equal(const void *a, const void *b)
void markVarForSelectPriv(ParseState *pstate, Var *var, RangeTblEntry *rte)
int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...)
Oid get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok)
static TargetEntry * findTargetlistEntrySQL99(ParseState *pstate, Node *node, List **tlist, ParseExprKind exprKind)
Oid get_equality_op_for_ordering_op(Oid opno, bool *reverse)
Node * transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind)
List * list_truncate(List *list, int new_size)
Node * coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod, CoercionContext ccontext, CoercionForm cformat, int location)
static Node * transformJoinUsingClause(ParseState *pstate, RangeTblEntry *leftRTE, RangeTblEntry *rightRTE, List *leftVars, List *rightVars)
Relation parserOpenTable(ParseState *pstate, const RangeVar *relation, int lockmode)
int errcode(int sqlerrcode)
void transformOnConflictArbiter(ParseState *pstate, OnConflictClause *onConflictClause, List **arbiterExpr, Node **arbiterWhere, Oid *constraint)
List * list_concat(List *list1, List *list2)
int locate_windowfunc(Node *node)
static int fc(const char *x)
int pg_strcasecmp(const char *s1, const char *s2)
Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok)
static Node * transformGroupingSet(List **flatresult, ParseState *pstate, GroupingSet *gset, List **targetlist, List *sortClause, ParseExprKind exprKind, bool useSQL99, bool toplevel)
A_Expr * makeSimpleA_Expr(A_Expr_Kind kind, char *name, Node *lexpr, Node *rexpr, int location)
Node * transformLimitClause(ParseState *pstate, Node *clause, ParseExprKind exprKind, const char *constructName)
#define OidIsValid(objectId)
static Node * transformFrameOffset(ParseState *pstate, int frameOptions, Node *clause)
const char * ParseExprKindName(ParseExprKind exprKind)
Oid get_func_rettype(Oid funcid)
Expr * makeBoolExpr(BoolExprType boolop, List *args, int location)
static void extractRemainingColumns(List *common_colnames, List *src_colnames, List *src_colvars, List **res_colnames, List **res_colvars)
void * copyObject(const void *from)
bool interpretInhOption(InhOption inhOpt)
void assign_expr_collations(ParseState *pstate, Node *expr)
static int get_matching_location(int sortgroupref, List *sortgrouprefs, List *exprs)
int locate_var_of_level(Node *node, int levelsup)
bool defGetBoolean(DefElem *def)
void cancel_parser_errposition_callback(ParseCallbackState *pcbstate)
bool op_hashjoinable(Oid opno, Oid inputtype)
SortByNulls nulls_ordering
static RangeTblEntry * transformRangeSubselect(ParseState *pstate, RangeSubselect *r)
char * FigureColname(Node *node)
static RangeTblEntry * transformTableEntry(ParseState *pstate, RangeVar *r)
static List * transformGroupClauseList(List **flatresult, ParseState *pstate, List *list, List **targetlist, List *sortClause, ParseExprKind exprKind, bool useSQL99, bool toplevel)
bool list_member_int(const List *list, int datum)
void assign_list_collations(ParseState *pstate, List *exprs)
static void setNamespaceLateralState(List *namespace, bool lateral_only, bool lateral_ok)
void * list_nth(const List *list, int n)
RelabelType * makeRelabelType(Expr *arg, Oid rtype, int32 rtypmod, Oid rcollid, CoercionForm rformat)
void check_stack_depth(void)
static Node * flatten_grouping_sets(Node *expr, bool toplevel, bool *hasGroupingSets)
RangeTblEntry * addRangeTableEntry(ParseState *pstate, RangeVar *relation, Alias *alias, bool inh, bool inFromCl)
List * transformGroupClause(ParseState *pstate, List *grouplist, List **groupingSets, List **targetlist, List *sortClause, ParseExprKind exprKind, bool useSQL99)
#define RelationGetRelationName(relation)
void checkNameSpaceConflicts(ParseState *pstate, List *namespace1, List *namespace2)
#define list_make1_int(x1)
#define ereport(elevel, rest)
#define rt_fetch(rangetable_index, rangetable)
TargetEntry * get_sortgroupref_tle(Index sortref, List *targetList)
void setup_parser_errposition_callback(ParseCallbackState *pcbstate, ParseState *pstate, int location)
void addRTEtoQuery(ParseState *pstate, RangeTblEntry *rte, bool addToJoinList, bool addToRelNameSpace, bool addToVarNameSpace)
List * lappend_int(List *list, int datum)
List * lappend(List *list, void *datum)
RangeTblEntry * addRangeTableEntryForSubquery(ParseState *pstate, Query *subquery, Alias *alias, bool lateral, bool inFromCl)
static Node * buildMergedJoinVar(ParseState *pstate, JoinType jointype, Var *l_colvar, Var *r_colvar)
int locate_agg_of_level(Node *node, int levelsup)
void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up, int location, bool include_dropped, List **colnames, List **colvars)
char * NameListToString(List *names)
static TableSampleClause * transformRangeTableSample(ParseState *pstate, RangeTableSample *rts)
static void setNamespaceColumnVisibility(List *namespace, bool cols_visible)
FuncCall * makeFuncCall(List *name, List *args, int location)
List * transformWindowDefinitions(ParseState *pstate, List *windowdefs, List **targetlist)
static RangeTblEntry * transformCTEReference(ParseState *pstate, RangeVar *r, CommonTableExpr *cte, Index levelsup)
RangeTblEntry * p_target_rangetblentry
void transformFromClause(ParseState *pstate, List *frmList)
ParseExprKind p_expr_kind
Oid LookupCollation(ParseState *pstate, List *collnames, int location)
#define RelationIsUsedAsCatalogTable(relation)
int setTargetTable(ParseState *pstate, RangeVar *relation, bool inh, bool alsoSource, AclMode requiredPerms)
bool targetIsInSortList(TargetEntry *tle, Oid sortop, List *sortList)
RangeTblEntry * addRangeTableEntryForFunction(ParseState *pstate, List *funcnames, List *funcexprs, List *coldeflists, RangeFunction *rangefunc, bool lateral, bool inFromCl)
Node * colNameToVar(ParseState *pstate, char *colname, bool localonly, int location)
TsmRoutine * GetTsmRoutine(Oid tsmhandler)
CommonTableExpr * scanNameSpaceForCTE(ParseState *pstate, const char *refname, Index *ctelevelsup)
#define FRAMEOPTION_RANGE
#define Assert(condition)
static RangeTblEntry * transformRangeFunction(ParseState *pstate, RangeFunction *r)
static Node * transformFromClauseItem(ParseState *pstate, Node *n, RangeTblEntry **top_rte, int *top_rti, List **namespace)
List * transformSortClause(ParseState *pstate, List *orderlist, List **targetlist, ParseExprKind exprKind, bool resolveUnknown, bool useSQL99)
void get_sort_group_operators(Oid argtype, bool needLT, bool needEQ, bool needGT, Oid *ltOpr, Oid *eqOpr, Oid *gtOpr, bool *isHashable)
Node * transformWhereClause(ParseState *pstate, Node *clause, ParseExprKind exprKind, const char *constructName)
bool contain_vars_of_level(Node *node, int levelsup)
Oid exprType(const Node *expr)
static TargetEntry * findTargetlistEntrySQL92(ParseState *pstate, Node *node, List **tlist, ParseExprKind exprKind)
static int list_length(const List *l)
int parser_errposition(ParseState *pstate, int location)
static void checkTargetlistEntrySQL92(ParseState *pstate, TargetEntry *tle, ParseExprKind exprKind)
RangeTblEntry * addRangeTableEntryForRelation(ParseState *pstate, Relation rel, Alias *alias, bool inh, bool inFromCl)
Bitmapset * bms_add_member(Bitmapset *a, int x)
Query * parse_sub_analyze(Node *parseTree, ParseState *parentParseState, CommonTableExpr *parentCTE, bool locked_from_parent)
bool contain_aggs_of_level(Node *node, int levelsup)
bool interpretOidsOption(List *defList, bool allowOids)
Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes, bool noError)
static const struct cname cnames[]
static ParseNamespaceItem * makeNamespaceItem(RangeTblEntry *rte, bool rel_visible, bool cols_visible, bool lateral_only, bool lateral_ok)
static List * addTargetToGroupList(ParseState *pstate, TargetEntry *tle, List *grouplist, List *targetlist, int location, bool resolveUnknown)
int errmsg(const char *fmt,...)
Oid compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError)
GroupingSet * makeGroupingSet(GroupingSetKind kind, List *content, int location)
static Node * transformJoinOnClause(ParseState *pstate, JoinExpr *j, List *namespace)
Relation p_target_relation
RangeTblEntry * addRangeTableEntryForCTE(ParseState *pstate, CommonTableExpr *cte, Index levelsup, RangeVar *rv, bool inFromCl)
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)
List * addTargetToSortList(ParseState *pstate, TargetEntry *tle, List *sortlist, List *targetlist, SortBy *sortby, bool resolveUnknown)
bool isLockedRefname(ParseState *pstate, const char *refname)
List * transformDistinctClause(ParseState *pstate, List **targetlist, List *sortClause, bool is_agg)
TargetEntry * transformTargetEntry(ParseState *pstate, Node *node, Node *expr, ParseExprKind exprKind, char *colname, bool resjunk)
bool bms_is_member(int x, const Bitmapset *a)
static WindowClause * findWindowClause(List *wclist, const char *name)
struct TableSampleClause * tablesample
#define RelationGetRelid(relation)
bool contain_windowfuncs(Node *node)
static struct subre * parse(struct vars *, int, int, struct state *, struct state *)
static Index transformGroupClauseExpr(List **flatresult, Bitmapset *seen_local, ParseState *pstate, Node *gexpr, List **targetlist, List *sortClause, ParseExprKind exprKind, bool useSQL99, bool toplevel)
static List * resolve_unique_index_expr(ParseState *pstate, InferClause *infer, Relation heapRel)
Node * strip_implicit_coercions(Node *node)
Node * coerce_to_boolean(ParseState *pstate, Node *node, const char *constructName)