72#define MAX_FUZZY_DISTANCE 3
84 const char *colname,
int location,
90 int rtindex,
int sublevels_up,
95 int count,
int offset,
96 int rtindex,
int sublevels_up,
131 const char *schemaname,
141 if (schemaname !=
NULL)
161 while (pstate !=
NULL)
211 if (!
nsitem->p_rel_visible)
222 errmsg(
"table reference \"%s\" is ambiguous",
252 if (!
nsitem->p_rel_visible)
263 rte->relid == relid &&
269 errmsg(
"table reference %u is ambiguous",
303 *ctelevelsup = levelsup;
362 const char *refname = relation->
relname;
366 Index ctelevelsup = 0;
408 rte->ctelevelsup + levelsup == ctelevelsup &&
415 if (
strcmp(
rte->eref->aliasname, refname) == 0)
469 errmsg(
"table name \"%s\" specified more than once",
494 char *refname =
nsitem->p_names->aliasname;
498 errmsg(
"invalid reference to FROM-clause entry for table \"%s\"",
502 errhint(
"There is an entry for table \"%s\", but it cannot be referenced from this part of the query.",
504 errdetail(
"The combining JOIN type must be INNER or LEFT for a LATERAL reference."),
523 while (sublevels_up-- > 0)
532 if (
nsitem->p_rtindex == varno)
535 elog(
ERROR,
"nsitem not found (internal error)");
551 while (sublevels_up-- > 0)
564 elog(
ERROR,
"nsitem not found (internal error)");
577 while (sublevels_up-- > 0)
600 while (levelsup-- > 0)
604 elog(
ERROR,
"bad levelsup for CTE \"%s\"",
rte->ctename);
717 int sublevels_up,
const char *colname,
int location)
739 errmsg(
"system column \"%s\" reference in check constraint is invalid",
752 errmsg(
"cannot use system column \"%s\" in column generation expression",
763 errmsg(
"cannot use system column \"%s\" in MERGE WHEN condition",
774 if (
nscol->p_varno == 0)
777 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
779 nsitem->p_names->aliasname)));
788 var->varnosyn =
nscol->p_varnosyn;
789 var->varattnosyn =
nscol->p_varattnosyn;
845 const char *colname,
int location,
866 foreach(
c,
eref->colnames)
876 errmsg(
"column reference \"%s\" is ambiguous",
930 int sublevels_up = 0;
933 while (pstate !=
NULL)
943 if (!
nsitem->p_cols_visible)
958 errmsg(
"column reference \"%s\" is ambiguous",
1007 while (pstate !=
NULL)
1035 rte->eref->aliasname,
1080 int rtindex = var->
varno;
1098 var->varnullingrels =
bms_union(var->varnullingrels, relids);
1140 elog(
ERROR,
"could not find JoinExpr for whole-row reference");
1151 int varno = ((
JoinExpr *)
j->larg)->rtindex;
1156 elog(
ERROR,
"unrecognized node type: %d",
1166 int varno = ((
JoinExpr *)
j->rarg)->rtindex;
1171 elog(
ERROR,
"unrecognized node type: %d",
1246 for (varattno = 0; varattno <
maxattrs; varattno++)
1251 if (attr->attisdropped)
1279 errmsg(
"table \"%s\" has %d columns available but %d columns specified",
1298 Alias *alias,
int nfuncs)
1318 if (nfuncs == 1 && alias)
1353 for (varattno = 0; varattno <
maxattrs; varattno++)
1358 if (attr->attisdropped)
1362 nscolumns[varattno].p_varattno = varattno + 1;
1363 nscolumns[varattno].p_vartype = attr->atttypid;
1364 nscolumns[varattno].p_vartypmod = attr->atttypmod;
1365 nscolumns[varattno].p_varcollid = attr->attcollation;
1366 nscolumns[varattno].p_varnosyn = rtindex;
1367 nscolumns[varattno].p_varattnosyn = varattno + 1;
1374 nsitem->p_rtindex = rtindex;
1378 nsitem->p_rel_visible =
true;
1379 nsitem->p_cols_visible =
true;
1380 nsitem->p_lateral_only =
false;
1381 nsitem->p_lateral_ok =
true;
1425 nscolumns[varattno].p_varattno = varattno + 1;
1429 nscolumns[varattno].p_varnosyn = rtindex;
1430 nscolumns[varattno].p_varattnosyn = varattno + 1;
1438 nsitem->p_rtindex = rtindex;
1442 nsitem->p_rel_visible =
true;
1443 nsitem->p_cols_visible =
true;
1444 nsitem->p_lateral_only =
false;
1445 nsitem->p_lateral_ok =
true;
1471 errmsg(
"relation \"%s.%s\" does not exist",
1484 errmsg(
"relation \"%s\" does not exist",
1486 errdetail(
"There is a WITH item named \"%s\", but it cannot be referenced from this part of the query.",
1488 errhint(
"Use WITH RECURSIVE, or re-order the WITH items to remove forward references.")));
1492 errmsg(
"relation \"%s\" does not exist",
1546 rte->rellockmode = lockmode;
1561 rte->lateral =
false;
1627 rte->rellockmode = lockmode;
1642 rte->lateral =
false;
1694 rte->subquery = subquery;
1728 errmsg(
"table \"%s\" has %d columns available but %d columns specified",
1739 rte->lateral = lateral;
1833 rtfunc->funccolnames =
NIL;
1834 rtfunc->funccoltypes =
NIL;
1835 rtfunc->funccoltypmods =
NIL;
1836 rtfunc->funccolcollations =
NIL;
1837 rtfunc->funcparams =
NULL;
1852 if (coldeflist !=
NIL)
1870 errmsg(
"a column definition list is redundant for a function with OUT parameters"),
1876 errmsg(
"a column definition list is redundant for a function returning a named composite type"),
1883 errmsg(
"a column definition list is only allowed for functions returning \"record\""),
1894 errmsg(
"a column definition list is required for functions returning \"record\""),
1932 errmsg(
"column definition lists can have at most %d entries",
1938 foreach(
col, coldeflist)
1950 errmsg(
"column \"%s\" cannot be declared SETOF",
1954 &attrtype, &attrtypmod);
1965 rtfunc->funccolnames =
lappend(rtfunc->funccolnames,
1967 rtfunc->funccoltypes =
lappend_oid(rtfunc->funccoltypes,
1969 rtfunc->funccoltypmods =
lappend_int(rtfunc->funccoltypmods,
1971 rtfunc->funccolcollations =
lappend_oid(rtfunc->funccolcollations,
1993 errmsg(
"function \"%s\" in FROM has unsupported return type %s",
1998 rtfunc->funccolcount = tupdesc->
natts;
2011 if (nfuncs > 1 ||
rangefunc->ordinality)
2020 errmsg(
"functions in FROM can return at most %d columns",
2028 for (
i = 0;
i < nfuncs;
i++)
2063 rte->lateral = lateral;
2105 errmsg(
"functions in FROM can return at most %d columns",
2116 rte->tablefunc = tf;
2117 rte->coltypes = tf->coltypes;
2118 rte->coltypmods = tf->coltypmods;
2119 rte->colcollations = tf->colcollations;
2135 errmsg(
"%s function has %d columns available but %d columns specified",
2147 rte->lateral = lateral;
2162 rte->coltypes,
rte->coltypmods,
2163 rte->colcollations);
2191 rte->relid = graphid;
2193 rte->graph_pattern = graph_pattern;
2194 rte->graph_table_columns = columns;
2200 if (!
eref->colnames)
2201 eref->colnames = colnames;
2207 foreach(
lc, colnames)
2216 errmsg(
"GRAPH_TABLE \"%s\" has %d columns available but %d columns specified",
2221 foreach(
lc, columns)
2234 rte->lateral = lateral;
2286 rte->values_lists = exprs;
2309 errmsg(
"VALUES lists \"%s\" have %d columns available but %d columns specified",
2320 rte->lateral = lateral;
2335 rte->coltypes,
rte->coltypmods,
2336 rte->colcollations);
2374 errmsg(
"joins can have at most %d columns",
2380 rte->jointype = jointype;
2399 errmsg(
"join expression \"%s\" has %d columns available but %d columns specified",
2410 rte->lateral =
false;
2431 nsitem->p_rel_visible =
true;
2432 nsitem->p_cols_visible =
true;
2433 nsitem->p_lateral_only =
false;
2434 nsitem->p_lateral_ok =
true;
2467 rte->ctelevelsup = levelsup;
2471 Assert(cte->cterecursive || !
rte->self_reference);
2473 if (!
rte->self_reference)
2490 errmsg(
"WITH query \"%s\" does not have a RETURNING clause",
2508 foreach(
lc, cte->ctecolnames)
2517 errmsg(
"table \"%s\" has %d columns available but %d columns specified",
2522 if (cte->search_clause)
2525 if (cte->search_clause->search_breadth_first)
2535 if (cte->cycle_clause)
2539 rte->coltypmods =
lappend_int(
rte->coltypmods, cte->cycle_clause->cycle_mark_typmod);
2540 rte->colcollations =
lappend_oid(
rte->colcollations, cte->cycle_clause->cycle_mark_collation);
2556 rte->lateral =
false;
2571 rte->coltypes,
rte->coltypmods,
2572 rte->colcollations);
2578 if (
rte->ctelevelsup > 0)
2614 switch (
enrmd->enrtype)
2644 rte->colcollations =
NIL;
2645 for (attno = 1; attno <= tupdesc->
natts; ++attno)
2649 if (att->attisdropped)
2660 elog(
ERROR,
"atttypid is invalid for non-dropped column in \"%s\"",
2675 rte->lateral =
false;
2720 foreach(
lc, groupClauses)
2723 char *colname = te->resname ?
pstrdup(te->resname) :
"?column?";
2738 rte->groupexprs = groupexprs;
2746 rte->lateral =
false;
2747 rte->inFromCl =
false;
2796 if (
lc->lockedRels ==
NIL)
2801 else if (refname !=
NULL)
2806 foreach(l2,
lc->lockedRels)
2841 nsitem->p_lateral_only =
false;
2842 nsitem->p_lateral_ok =
true;
2878 switch (
rte->rtekind)
2883 rtindex, sublevels_up, returning_type, location,
2911 elog(
ERROR,
"too few column names for subquery %s",
2912 rte->eref->aliasname);
2930 varnode->varreturningtype = returning_type;
2946 foreach(
lc,
rte->functions)
2954 if (rtfunc->funccolnames !=
NIL)
2968 rtindex, sublevels_up,
2969 returning_type, location,
2976 *colnames =
lappend(*colnames,
2989 varnode->varreturningtype = returning_type;
3005 rtfunc->funccolcount);
3017 l2, rtfunc->funccoltypmods,
3018 l3, rtfunc->funccolcollations)
3032 varnode->varreturningtype = returning_type;
3041 elog(
ERROR,
"function in FROM has unsupported return type");
3047 if (
rte->funcordinality)
3050 *colnames =
lappend(*colnames,
3062 varnode->varreturningtype = returning_type;
3096 *colnames =
lappend(*colnames,
3117 *colnames =
lappend(*colnames,
3137 varnode->varlevelsup = sublevels_up;
3145 varnode->varreturningtype = returning_type;
3183 *colnames =
lappend(*colnames,
3187 *colnames =
lappend(*colnames,
3202 varnode->varreturningtype = returning_type;
3226 elog(
ERROR,
"unrecognized RTE kind: %d", (
int)
rte->rtekind);
3244 rtindex, sublevels_up, returning_type,
3261 int rtindex,
int sublevels_up,
3273 for (varattno = 0; varattno < count; varattno++)
3277 if (attr->attisdropped)
3320 attr->atttypid, attr->atttypmod,
3323 varnode->varreturningtype = returning_type;
3344 int sublevels_up,
int location,
3354 foreach(
lc,
nsitem->p_names->colnames)
3360 if (
nscol->p_dontexpand)
3364 else if (colname[0])
3377 var->varnosyn =
nscol->p_varnosyn;
3378 var->varattnosyn =
nscol->p_varattnosyn;
3502 elog(
ERROR,
"invalid attnum %d for rangetable entry %s",
3516 switch (
rte->rtekind)
3530 elog(
ERROR,
"cache lookup failed for attribute %d of relation %u",
3591 foreach(
lc,
rte->functions)
3601 if (rtfunc->funccolnames !=
NIL)
3630 errmsg(
"column %d of relation \"%s\" does not exist",
3632 rte->eref->aliasname)));
3640 errmsg(
"column %d of relation \"%s\" does not exist",
3642 rte->eref->aliasname)));
3646 elog(
ERROR,
"unrecognized RTE kind: %d", (
int)
rte->rtekind);
3670 if (
tle->resno == resno)
3690 if (rc->
rti == rtindex)
3766 if (
attid >
rd->rd_att->natts)
3788 if (
attid >
rd->rd_att->natts)
3806 if (
attid >
rd->rd_att->natts)
3857 errmsg(
"invalid reference to FROM-clause entry for table \"%s\"",
3859 errhint(
"Perhaps you meant to reference the table alias \"%s\".",
3866 errmsg(
"invalid reference to FROM-clause entry for table \"%s\"",
3868 errdetail(
"There is an entry for table \"%s\", but it cannot be referenced from this part of the query.",
3869 rte->eref->aliasname),
3871 errhint(
"To reference that table, you must mark this subquery with LATERAL.") : 0,
3877 errmsg(
"missing FROM-clause entry for table \"%s\"",
3890 const char *
relname,
const char *colname,
int location)
3916 errmsg(
"column \"%s\" does not exist", colname),
3917 errdetail(
"There are columns named \"%s\", but they are in tables that cannot be referenced from this part of the query.",
3926 errmsg(
"column \"%s\" does not exist", colname),
3927 errdetail(
"There is a column named \"%s\" in table \"%s\", but it cannot be referenced from this part of the query.",
3928 colname,
state->rexact1->eref->aliasname),
3930 errhint(
"To reference that column, you must mark this subquery with LATERAL.") :
3932 errhint(
"To reference that column, you must use a table-qualified name.") : 0,
3936 if (!
state->rsecond)
3944 errmsg(
"column \"%s\" does not exist", colname),
3951 errmsg(
"column \"%s\" does not exist", colname),
3952 errhint(
"Perhaps you meant to reference the column \"%s.%s\".",
3953 state->rfirst->eref->aliasname,
3955 state->first - 1))),
3965 errmsg(
"column \"%s\" does not exist", colname),
3966 errhint(
"Perhaps you meant to reference the column \"%s.%s\" or the column \"%s.%s\".",
3967 state->rfirst->eref->aliasname,
3970 state->rsecond->eref->aliasname,
3972 state->second - 1))),
3984 while (pstate !=
NULL)
4037 return nsitem->p_rel_visible && !
nsitem->p_cols_visible;
4084 if (
rte->perminfoindex == 0 ||
4086 elog(
ERROR,
"invalid perminfoindex %u in RTE with relid %u",
4087 rte->perminfoindex,
rte->relid);
4089 rte->perminfoindex - 1);
4091 elog(
ERROR,
"permission info at index %u (with relid=%u) does not match provided RTE (with relid=%u)",
#define InvalidAttrNumber
Bitmapset * bms_add_member(Bitmapset *a, int x)
Bitmapset * bms_union(const Bitmapset *a, const Bitmapset *b)
#define Assert(condition)
#define OidIsValid(objectId)
int errcode(int sqlerrcode)
int errhint(const char *fmt,...) pg_attribute_printf(1
int errdetail(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
#define palloc_object(type)
#define palloc_array(type, count)
char * get_func_result_name(Oid functionId)
TupleDesc get_expr_result_tupdesc(Node *expr, bool noError)
TypeFuncClass get_expr_result_type(Node *expr, Oid *resultTypeId, TupleDesc *resultTupleDesc)
@ TYPEFUNC_COMPOSITE_DOMAIN
const FormData_pg_attribute * SystemAttributeByName(const char *attname)
void CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind, int flags)
const FormData_pg_attribute * SystemAttributeDefinition(AttrNumber attno)
#define CHKATYPE_ANYRECORD
#define HeapTupleIsValid(tuple)
#define MaxTupleAttributeNumber
static void * GETSTRUCT(const HeapTupleData *tuple)
#define MaxHeapAttributeNumber
List * lappend(List *list, void *datum)
List * list_copy_tail(const List *oldlist, int nskip)
List * list_concat(List *list1, const List *list2)
List * list_copy(const List *oldlist)
List * lappend_int(List *list, int datum)
List * lappend_oid(List *list, Oid datum)
List * list_truncate(List *list, int new_size)
bool CheckRelationLockedByMe(Relation relation, LOCKMODE lockmode, bool orstronger)
char * get_attname(Oid relid, AttrNumber attnum, bool missing_ok)
Oid get_relname_relid(const char *relname, Oid relnamespace)
Alias * makeAlias(const char *aliasname, List *colnames)
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)
char * pstrdup(const char *in)
void * palloc0(Size size)
int namestrcmp(Name name, const char *str)
Oid LookupNamespaceNoError(const char *nspname)
#define RangeVarGetRelid(relation, lockmode, missing_ok)
Oid exprType(const Node *expr)
int32 exprTypmod(const Node *expr)
Oid exprCollation(const Node *expr)
int exprLocation(const Node *expr)
#define IsA(nodeptr, _type_)
EphemeralNamedRelationMetadata get_visible_ENR(ParseState *pstate, const char *refname)
bool name_matches_visible_ENR(ParseState *pstate, const char *refname)
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_GENERATED_COLUMN
@ EXPR_KIND_CHECK_CONSTRAINT
static bool rte_visible_if_lateral(ParseState *pstate, RangeTblEntry *rte)
void markNullableIfNeeded(ParseState *pstate, Var *var)
Relation parserOpenTable(ParseState *pstate, const RangeVar *relation, LOCKMODE lockmode)
CommonTableExpr * scanNameSpaceForCTE(ParseState *pstate, const char *refname, Index *ctelevelsup)
static FuzzyAttrMatchState * searchRangeTableForCol(ParseState *pstate, const char *alias, const char *colname, int location)
void errorMissingColumn(ParseState *pstate, const char *relname, const char *colname, int location)
static int specialAttNum(const char *attname)
Node * colNameToVar(ParseState *pstate, const char *colname, bool localonly, int location)
static ParseNamespaceItem * buildNSItemFromTupleDesc(RangeTblEntry *rte, Index rtindex, RTEPermissionInfo *perminfo, TupleDesc tupdesc)
static ParseNamespaceItem * scanNameSpaceForRelid(ParseState *pstate, Oid relid, int location)
CommonTableExpr * GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte, int rtelevelsup)
Oid attnumCollationId(Relation rd, int attid)
static RangeTblEntry * searchRangeTableForRel(ParseState *pstate, RangeVar *relation)
static void expandTupleDesc(TupleDesc tupdesc, Alias *eref, int count, int offset, int rtindex, int sublevels_up, VarReturningType returning_type, int location, bool include_dropped, List **colnames, List **colvars)
RTEPermissionInfo * getRTEPermissionInfo(List *rteperminfos, RangeTblEntry *rte)
ParseNamespaceItem * addRangeTableEntryForENR(ParseState *pstate, RangeVar *rv, bool inFromCl)
void markVarForSelectPriv(ParseState *pstate, Var *var)
ParseNamespaceItem * addRangeTableEntry(ParseState *pstate, RangeVar *relation, Alias *alias, bool inh, bool inFromCl)
RowMarkClause * get_parse_rowmark(Query *qry, Index rtindex)
char * get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum)
static ParseNamespaceItem * scanNameSpaceForRefname(ParseState *pstate, const char *refname, int location)
void errorMissingRTE(ParseState *pstate, RangeVar *relation)
ParseNamespaceItem * addRangeTableEntryForGraphTable(ParseState *pstate, Oid graphid, GraphPattern *graph_pattern, List *columns, List *colnames, Alias *alias, bool lateral, bool inFromCl)
TargetEntry * get_tle_by_resno(List *tlist, AttrNumber resno)
static bool isFutureCTE(ParseState *pstate, const char *refname)
ParseNamespaceItem * addRangeTableEntryForTableFunc(ParseState *pstate, TableFunc *tf, Alias *alias, bool lateral, bool inFromCl)
List * expandNSItemVars(ParseState *pstate, ParseNamespaceItem *nsitem, int sublevels_up, int location, List **colnames)
bool get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum)
static void updateFuzzyAttrMatchState(int fuzzy_rte_penalty, FuzzyAttrMatchState *fuzzystate, RangeTblEntry *rte, const char *actual, const char *match, int attnum)
static ParseNamespaceItem * buildNSItemFromLists(RangeTblEntry *rte, Index rtindex, List *coltypes, List *coltypmods, List *colcollations)
void addNSItemToQuery(ParseState *pstate, ParseNamespaceItem *nsitem, bool addToJoinList, bool addToRelNameSpace, bool addToVarNameSpace)
static int scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte, Alias *eref, const char *colname, int location, int fuzzy_rte_penalty, FuzzyAttrMatchState *fuzzystate)
#define MAX_FUZZY_DISTANCE
ParseNamespaceItem * addRangeTableEntryForRelation(ParseState *pstate, Relation rel, LOCKMODE lockmode, Alias *alias, bool inh, bool inFromCl)
void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up, VarReturningType returning_type, int location, bool include_dropped, List **colnames, List **colvars)
ParseNamespaceItem * GetNSItemByRangeTablePosn(ParseState *pstate, int varno, int sublevels_up)
bool scanNameSpaceForENR(ParseState *pstate, const char *refname)
Node * scanNSItemForColumn(ParseState *pstate, ParseNamespaceItem *nsitem, int sublevels_up, const char *colname, int location)
ParseNamespaceItem * addRangeTableEntryForFunction(ParseState *pstate, List *funcnames, List *funcexprs, List *coldeflists, RangeFunction *rangefunc, bool lateral, bool inFromCl)
bool isLockedRefname(ParseState *pstate, const char *refname)
Oid attnumTypeId(Relation rd, int attid)
RTEPermissionInfo * addRTEPermissionInfo(List **rteperminfos, RangeTblEntry *rte)
const NameData * attnumAttName(Relation rd, int attid)
ParseNamespaceItem * addRangeTableEntryForSubquery(ParseState *pstate, Query *subquery, Alias *alias, bool lateral, bool inFromCl)
static void expandRelation(Oid relid, Alias *eref, int rtindex, int sublevels_up, VarReturningType returning_type, int location, bool include_dropped, List **colnames, List **colvars)
ParseNamespaceItem * addRangeTableEntryForCTE(ParseState *pstate, CommonTableExpr *cte, Index levelsup, RangeVar *rv, bool inFromCl)
static bool rte_visible_if_qualified(ParseState *pstate, RangeTblEntry *rte)
ParseNamespaceItem * addRangeTableEntryForGroup(ParseState *pstate, List *groupClauses)
static void markRTEForSelectPriv(ParseState *pstate, int rtindex, AttrNumber col)
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)
ParseNamespaceItem * GetNSItemByVar(ParseState *pstate, Var *var)
RangeTblEntry * GetRTEByRangeTablePosn(ParseState *pstate, int varno, int sublevels_up)
static void buildRelationAliases(TupleDesc tupdesc, Alias *alias, Alias *eref)
int attnameAttNum(Relation rd, const char *attname, bool sysColOK)
void checkNameSpaceConflicts(ParseState *pstate, List *namespace1, List *namespace2)
static char * chooseScalarFunctionAlias(Node *funcexpr, char *funcname, Alias *alias, int nfuncs)
static ParseNamespaceItem * findNSItemForRTE(ParseState *pstate, RangeTblEntry *rte)
static void check_lateral_ref_ok(ParseState *pstate, ParseNamespaceItem *nsitem, int location)
ParseNamespaceItem * addRangeTableEntryForValues(ParseState *pstate, List *exprs, List *coltypes, List *coltypmods, List *colcollations, Alias *alias, bool lateral, bool inFromCl)
void typenameTypeIdAndMod(ParseState *pstate, const TypeName *typeName, Oid *typeid_p, int32 *typmod_p)
Oid GetColumnDefCollation(ParseState *pstate, const ColumnDef *coldef, Oid typeOid)
#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 forboth(cell1, list1, cell2, list2)
static Oid list_nth_oid(const List *list, int n)
#define forthree(cell1, list1, cell2, list2, cell3, list3)
static void * list_nth(const List *list, int n)
static ListCell * list_nth_cell(const List *list, int n)
static ListCell * list_head(const List *l)
#define list_nth_node(type, list, n)
static ListCell * lnext(const List *l, const ListCell *c)
#define ERRCODE_UNDEFINED_TABLE
static Datum Int16GetDatum(int16 X)
static Datum ObjectIdGetDatum(Oid X)
TupleDesc ENRMetadataGetTupDesc(EphemeralNamedRelationMetadata enrmd)
#define RelationGetRelid(relation)
#define RelationGetNumberOfAttributes(relation)
#define RelationGetRelationName(relation)
void relation_close(Relation relation, LOCKMODE lockmode)
Relation relation_open(Oid relationId, LOCKMODE lockmode)
ParseState * parentParseState
ParseNamespaceItem * p_target_nsitem
ParseExprKind p_expr_kind
bool p_locked_from_parent
VarReturningType varreturningtype
#define FirstLowInvalidHeapAttributeNumber
#define TableOidAttributeNumber
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache2(SysCacheIdentifier cacheId, Datum key1, Datum key2)
#define SearchSysCacheExists2(cacheId, key1, key2)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_openrv_extended(const RangeVar *relation, LOCKMODE lockmode, bool missing_ok)
TupleDesc CreateTemplateTupleDesc(int natts)
void TupleDescFinalize(TupleDesc tupdesc)
void TupleDescInitEntryCollation(TupleDesc desc, AttrNumber attributeNumber, Oid collationid)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
void TupleDescCopyEntry(TupleDesc dst, AttrNumber dstAttno, TupleDesc src, AttrNumber srcAttno)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
static CompactAttribute * TupleDescCompactAttr(TupleDesc tupdesc, int i)
String * makeString(char *str)
int varstr_levenshtein_less_equal(const char *source, int slen, const char *target, int tlen, int ins_c, int del_c, int sub_c, int max_d, bool trusted)