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."),
520 while (sublevels_up-- > 0)
529 if (
nsitem->p_rtindex == varno)
532 elog(
ERROR,
"nsitem not found (internal error)");
545 while (sublevels_up-- > 0)
568 while (levelsup-- > 0)
572 elog(
ERROR,
"bad levelsup for CTE \"%s\"",
rte->ctename);
685 int sublevels_up,
const char *colname,
int location)
707 errmsg(
"system column \"%s\" reference in check constraint is invalid",
720 errmsg(
"cannot use system column \"%s\" in column generation expression",
731 errmsg(
"cannot use system column \"%s\" in MERGE WHEN condition",
742 if (
nscol->p_varno == 0)
745 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
747 nsitem->p_names->aliasname)));
756 var->varnosyn =
nscol->p_varnosyn;
757 var->varattnosyn =
nscol->p_varattnosyn;
813 const char *colname,
int location,
834 foreach(
c,
eref->colnames)
844 errmsg(
"column reference \"%s\" is ambiguous",
898 int sublevels_up = 0;
901 while (pstate !=
NULL)
911 if (!
nsitem->p_cols_visible)
926 errmsg(
"column reference \"%s\" is ambiguous",
975 while (pstate !=
NULL)
1003 rte->eref->aliasname,
1048 int rtindex = var->
varno;
1066 var->varnullingrels =
bms_union(var->varnullingrels, relids);
1108 elog(
ERROR,
"could not find JoinExpr for whole-row reference");
1119 int varno = ((
JoinExpr *)
j->larg)->rtindex;
1124 elog(
ERROR,
"unrecognized node type: %d",
1134 int varno = ((
JoinExpr *)
j->rarg)->rtindex;
1139 elog(
ERROR,
"unrecognized node type: %d",
1214 for (varattno = 0; varattno <
maxattrs; varattno++)
1219 if (attr->attisdropped)
1247 errmsg(
"table \"%s\" has %d columns available but %d columns specified",
1266 Alias *alias,
int nfuncs)
1286 if (nfuncs == 1 && alias)
1321 for (varattno = 0; varattno <
maxattrs; varattno++)
1326 if (attr->attisdropped)
1330 nscolumns[varattno].p_varattno = varattno + 1;
1331 nscolumns[varattno].p_vartype = attr->atttypid;
1332 nscolumns[varattno].p_vartypmod = attr->atttypmod;
1333 nscolumns[varattno].p_varcollid = attr->attcollation;
1334 nscolumns[varattno].p_varnosyn = rtindex;
1335 nscolumns[varattno].p_varattnosyn = varattno + 1;
1342 nsitem->p_rtindex = rtindex;
1346 nsitem->p_rel_visible =
true;
1347 nsitem->p_cols_visible =
true;
1348 nsitem->p_lateral_only =
false;
1349 nsitem->p_lateral_ok =
true;
1393 nscolumns[varattno].p_varattno = varattno + 1;
1397 nscolumns[varattno].p_varnosyn = rtindex;
1398 nscolumns[varattno].p_varattnosyn = varattno + 1;
1406 nsitem->p_rtindex = rtindex;
1410 nsitem->p_rel_visible =
true;
1411 nsitem->p_cols_visible =
true;
1412 nsitem->p_lateral_only =
false;
1413 nsitem->p_lateral_ok =
true;
1439 errmsg(
"relation \"%s.%s\" does not exist",
1452 errmsg(
"relation \"%s\" does not exist",
1454 errdetail(
"There is a WITH item named \"%s\", but it cannot be referenced from this part of the query.",
1456 errhint(
"Use WITH RECURSIVE, or re-order the WITH items to remove forward references.")));
1460 errmsg(
"relation \"%s\" does not exist",
1514 rte->rellockmode = lockmode;
1529 rte->lateral =
false;
1595 rte->rellockmode = lockmode;
1610 rte->lateral =
false;
1662 rte->subquery = subquery;
1696 errmsg(
"table \"%s\" has %d columns available but %d columns specified",
1707 rte->lateral = lateral;
1801 rtfunc->funccolnames =
NIL;
1802 rtfunc->funccoltypes =
NIL;
1803 rtfunc->funccoltypmods =
NIL;
1804 rtfunc->funccolcollations =
NIL;
1805 rtfunc->funcparams =
NULL;
1820 if (coldeflist !=
NIL)
1838 errmsg(
"a column definition list is redundant for a function with OUT parameters"),
1844 errmsg(
"a column definition list is redundant for a function returning a named composite type"),
1851 errmsg(
"a column definition list is only allowed for functions returning \"record\""),
1862 errmsg(
"a column definition list is required for functions returning \"record\""),
1900 errmsg(
"column definition lists can have at most %d entries",
1906 foreach(
col, coldeflist)
1918 errmsg(
"column \"%s\" cannot be declared SETOF",
1922 &attrtype, &attrtypmod);
1933 rtfunc->funccolnames =
lappend(rtfunc->funccolnames,
1935 rtfunc->funccoltypes =
lappend_oid(rtfunc->funccoltypes,
1937 rtfunc->funccoltypmods =
lappend_int(rtfunc->funccoltypmods,
1939 rtfunc->funccolcollations =
lappend_oid(rtfunc->funccolcollations,
1961 errmsg(
"function \"%s\" in FROM has unsupported return type %s",
1966 rtfunc->funccolcount = tupdesc->
natts;
1979 if (nfuncs > 1 ||
rangefunc->ordinality)
1988 errmsg(
"functions in FROM can return at most %d columns",
1996 for (
i = 0;
i < nfuncs;
i++)
2031 rte->lateral = lateral;
2073 errmsg(
"functions in FROM can return at most %d columns",
2084 rte->tablefunc = tf;
2085 rte->coltypes = tf->coltypes;
2086 rte->coltypmods = tf->coltypmods;
2087 rte->colcollations = tf->colcollations;
2103 errmsg(
"%s function has %d columns available but %d columns specified",
2115 rte->lateral = lateral;
2130 rte->coltypes,
rte->coltypmods,
2131 rte->colcollations);
2159 rte->relid = graphid;
2161 rte->graph_pattern = graph_pattern;
2162 rte->graph_table_columns = columns;
2168 if (!
eref->colnames)
2169 eref->colnames = colnames;
2175 foreach(
lc, colnames)
2184 errmsg(
"GRAPH_TABLE \"%s\" has %d columns available but %d columns specified",
2189 foreach(
lc, columns)
2202 rte->lateral = lateral;
2254 rte->values_lists = exprs;
2277 errmsg(
"VALUES lists \"%s\" have %d columns available but %d columns specified",
2288 rte->lateral = lateral;
2303 rte->coltypes,
rte->coltypmods,
2304 rte->colcollations);
2342 errmsg(
"joins can have at most %d columns",
2348 rte->jointype = jointype;
2367 errmsg(
"join expression \"%s\" has %d columns available but %d columns specified",
2378 rte->lateral =
false;
2399 nsitem->p_rel_visible =
true;
2400 nsitem->p_cols_visible =
true;
2401 nsitem->p_lateral_only =
false;
2402 nsitem->p_lateral_ok =
true;
2435 rte->ctelevelsup = levelsup;
2439 Assert(cte->cterecursive || !
rte->self_reference);
2441 if (!
rte->self_reference)
2458 errmsg(
"WITH query \"%s\" does not have a RETURNING clause",
2476 foreach(
lc, cte->ctecolnames)
2485 errmsg(
"table \"%s\" has %d columns available but %d columns specified",
2490 if (cte->search_clause)
2493 if (cte->search_clause->search_breadth_first)
2503 if (cte->cycle_clause)
2507 rte->coltypmods =
lappend_int(
rte->coltypmods, cte->cycle_clause->cycle_mark_typmod);
2508 rte->colcollations =
lappend_oid(
rte->colcollations, cte->cycle_clause->cycle_mark_collation);
2524 rte->lateral =
false;
2539 rte->coltypes,
rte->coltypmods,
2540 rte->colcollations);
2546 if (
rte->ctelevelsup > 0)
2582 switch (
enrmd->enrtype)
2612 rte->colcollations =
NIL;
2613 for (attno = 1; attno <= tupdesc->
natts; ++attno)
2617 if (
att->attisdropped)
2628 elog(
ERROR,
"atttypid is invalid for non-dropped column in \"%s\"",
2643 rte->lateral =
false;
2688 foreach(
lc, groupClauses)
2691 char *colname = te->resname ?
pstrdup(te->resname) :
"?column?";
2706 rte->groupexprs = groupexprs;
2714 rte->lateral =
false;
2715 rte->inFromCl =
false;
2764 if (
lc->lockedRels ==
NIL)
2769 else if (refname !=
NULL)
2774 foreach(l2,
lc->lockedRels)
2809 nsitem->p_lateral_only =
false;
2810 nsitem->p_lateral_ok =
true;
2846 switch (
rte->rtekind)
2851 rtindex, sublevels_up, returning_type, location,
2879 elog(
ERROR,
"too few column names for subquery %s",
2880 rte->eref->aliasname);
2898 varnode->varreturningtype = returning_type;
2914 foreach(
lc,
rte->functions)
2922 if (rtfunc->funccolnames !=
NIL)
2936 rtindex, sublevels_up,
2937 returning_type, location,
2944 *colnames =
lappend(*colnames,
2957 varnode->varreturningtype = returning_type;
2973 rtfunc->funccolcount);
2985 l2, rtfunc->funccoltypmods,
2986 l3, rtfunc->funccolcollations)
3000 varnode->varreturningtype = returning_type;
3009 elog(
ERROR,
"function in FROM has unsupported return type");
3015 if (
rte->funcordinality)
3018 *colnames =
lappend(*colnames,
3030 varnode->varreturningtype = returning_type;
3064 *colnames =
lappend(*colnames,
3085 *colnames =
lappend(*colnames,
3105 varnode->varlevelsup = sublevels_up;
3113 varnode->varreturningtype = returning_type;
3151 *colnames =
lappend(*colnames,
3155 *colnames =
lappend(*colnames,
3170 varnode->varreturningtype = returning_type;
3194 elog(
ERROR,
"unrecognized RTE kind: %d", (
int)
rte->rtekind);
3212 rtindex, sublevels_up, returning_type,
3229 int rtindex,
int sublevels_up,
3241 for (varattno = 0; varattno < count; varattno++)
3245 if (attr->attisdropped)
3288 attr->atttypid, attr->atttypmod,
3291 varnode->varreturningtype = returning_type;
3312 int sublevels_up,
int location,
3322 foreach(
lc,
nsitem->p_names->colnames)
3328 if (
nscol->p_dontexpand)
3332 else if (colname[0])
3345 var->varnosyn =
nscol->p_varnosyn;
3346 var->varattnosyn =
nscol->p_varattnosyn;
3352 result =
lappend(result, var);
3470 elog(
ERROR,
"invalid attnum %d for rangetable entry %s",
3484 switch (
rte->rtekind)
3498 elog(
ERROR,
"cache lookup failed for attribute %d of relation %u",
3501 result =
att_tup->attisdropped;
3559 foreach(
lc,
rte->functions)
3569 if (rtfunc->funccolnames !=
NIL)
3583 return att->attisdropped;
3598 errmsg(
"column %d of relation \"%s\" does not exist",
3600 rte->eref->aliasname)));
3608 errmsg(
"column %d of relation \"%s\" does not exist",
3610 rte->eref->aliasname)));
3614 elog(
ERROR,
"unrecognized RTE kind: %d", (
int)
rte->rtekind);
3638 if (
tle->resno == resno)
3658 if (rc->
rti == rtindex)
3733 if (
attid >
rd->rd_att->natts)
3755 if (
attid >
rd->rd_att->natts)
3773 if (
attid >
rd->rd_att->natts)
3824 errmsg(
"invalid reference to FROM-clause entry for table \"%s\"",
3826 errhint(
"Perhaps you meant to reference the table alias \"%s\".",
3833 errmsg(
"invalid reference to FROM-clause entry for table \"%s\"",
3835 errdetail(
"There is an entry for table \"%s\", but it cannot be referenced from this part of the query.",
3836 rte->eref->aliasname),
3838 errhint(
"To reference that table, you must mark this subquery with LATERAL.") : 0,
3844 errmsg(
"missing FROM-clause entry for table \"%s\"",
3857 const char *
relname,
const char *colname,
int location)
3883 errmsg(
"column \"%s\" does not exist", colname),
3884 errdetail(
"There are columns named \"%s\", but they are in tables that cannot be referenced from this part of the query.",
3893 errmsg(
"column \"%s\" does not exist", colname),
3894 errdetail(
"There is a column named \"%s\" in table \"%s\", but it cannot be referenced from this part of the query.",
3895 colname,
state->rexact1->eref->aliasname),
3897 errhint(
"To reference that column, you must mark this subquery with LATERAL.") :
3899 errhint(
"To reference that column, you must use a table-qualified name.") : 0,
3903 if (!
state->rsecond)
3911 errmsg(
"column \"%s\" does not exist", colname),
3918 errmsg(
"column \"%s\" does not exist", colname),
3919 errhint(
"Perhaps you meant to reference the column \"%s.%s\".",
3920 state->rfirst->eref->aliasname,
3922 state->first - 1))),
3932 errmsg(
"column \"%s\" does not exist", colname),
3933 errhint(
"Perhaps you meant to reference the column \"%s.%s\" or the column \"%s.%s\".",
3934 state->rfirst->eref->aliasname,
3937 state->rsecond->eref->aliasname,
3939 state->second - 1))),
3951 while (pstate !=
NULL)
4004 return nsitem->p_rel_visible && !
nsitem->p_cols_visible;
4051 if (
rte->perminfoindex == 0 ||
4053 elog(
ERROR,
"invalid perminfoindex %u in RTE with relid %u",
4054 rte->perminfoindex,
rte->relid);
4056 rte->perminfoindex - 1);
4058 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)
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)