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\""),
1899 errmsg(
"column definition lists can have at most %d entries",
1905 foreach(
col, coldeflist)
1917 errmsg(
"column \"%s\" cannot be declared SETOF",
1921 &attrtype, &attrtypmod);
1932 rtfunc->funccolnames =
lappend(rtfunc->funccolnames,
1934 rtfunc->funccoltypes =
lappend_oid(rtfunc->funccoltypes,
1936 rtfunc->funccoltypmods =
lappend_int(rtfunc->funccoltypmods,
1938 rtfunc->funccolcollations =
lappend_oid(rtfunc->funccolcollations,
1959 errmsg(
"function \"%s\" in FROM has unsupported return type %s",
1964 rtfunc->funccolcount = tupdesc->
natts;
1977 if (nfuncs > 1 ||
rangefunc->ordinality)
1986 errmsg(
"functions in FROM can return at most %d columns",
1994 for (
i = 0;
i < nfuncs;
i++)
2029 rte->lateral = lateral;
2071 errmsg(
"functions in FROM can return at most %d columns",
2082 rte->tablefunc = tf;
2083 rte->coltypes = tf->coltypes;
2084 rte->coltypmods = tf->coltypmods;
2085 rte->colcollations = tf->colcollations;
2101 errmsg(
"%s function has %d columns available but %d columns specified",
2113 rte->lateral = lateral;
2128 rte->coltypes,
rte->coltypmods,
2129 rte->colcollations);
2159 rte->values_lists = exprs;
2182 errmsg(
"VALUES lists \"%s\" have %d columns available but %d columns specified",
2193 rte->lateral = lateral;
2208 rte->coltypes,
rte->coltypmods,
2209 rte->colcollations);
2247 errmsg(
"joins can have at most %d columns",
2253 rte->jointype = jointype;
2272 errmsg(
"join expression \"%s\" has %d columns available but %d columns specified",
2283 rte->lateral =
false;
2304 nsitem->p_rel_visible =
true;
2305 nsitem->p_cols_visible =
true;
2306 nsitem->p_lateral_only =
false;
2307 nsitem->p_lateral_ok =
true;
2340 rte->ctelevelsup = levelsup;
2344 Assert(cte->cterecursive || !
rte->self_reference);
2346 if (!
rte->self_reference)
2363 errmsg(
"WITH query \"%s\" does not have a RETURNING clause",
2381 foreach(
lc, cte->ctecolnames)
2390 errmsg(
"table \"%s\" has %d columns available but %d columns specified",
2395 if (cte->search_clause)
2398 if (cte->search_clause->search_breadth_first)
2408 if (cte->cycle_clause)
2412 rte->coltypmods =
lappend_int(
rte->coltypmods, cte->cycle_clause->cycle_mark_typmod);
2413 rte->colcollations =
lappend_oid(
rte->colcollations, cte->cycle_clause->cycle_mark_collation);
2429 rte->lateral =
false;
2444 rte->coltypes,
rte->coltypmods,
2445 rte->colcollations);
2451 if (
rte->ctelevelsup > 0)
2487 switch (
enrmd->enrtype)
2517 rte->colcollations =
NIL;
2518 for (attno = 1; attno <= tupdesc->
natts; ++attno)
2522 if (
att->attisdropped)
2533 elog(
ERROR,
"atttypid is invalid for non-dropped column in \"%s\"",
2548 rte->lateral =
false;
2593 foreach(
lc, groupClauses)
2596 char *colname = te->resname ?
pstrdup(te->resname) :
"?column?";
2611 rte->groupexprs = groupexprs;
2619 rte->lateral =
false;
2620 rte->inFromCl =
false;
2669 if (
lc->lockedRels ==
NIL)
2674 else if (refname !=
NULL)
2679 foreach(l2,
lc->lockedRels)
2714 nsitem->p_lateral_only =
false;
2715 nsitem->p_lateral_ok =
true;
2751 switch (
rte->rtekind)
2756 rtindex, sublevels_up, returning_type, location,
2784 elog(
ERROR,
"too few column names for subquery %s",
2785 rte->eref->aliasname);
2803 varnode->varreturningtype = returning_type;
2819 foreach(
lc,
rte->functions)
2827 if (rtfunc->funccolnames !=
NIL)
2841 rtindex, sublevels_up,
2842 returning_type, location,
2849 *colnames =
lappend(*colnames,
2862 varnode->varreturningtype = returning_type;
2878 rtfunc->funccolcount);
2890 l2, rtfunc->funccoltypmods,
2891 l3, rtfunc->funccolcollations)
2905 varnode->varreturningtype = returning_type;
2914 elog(
ERROR,
"function in FROM has unsupported return type");
2920 if (
rte->funcordinality)
2923 *colnames =
lappend(*colnames,
2935 varnode->varreturningtype = returning_type;
2969 *colnames =
lappend(*colnames,
2990 *colnames =
lappend(*colnames,
3010 varnode->varlevelsup = sublevels_up;
3018 varnode->varreturningtype = returning_type;
3055 *colnames =
lappend(*colnames,
3059 *colnames =
lappend(*colnames,
3074 varnode->varreturningtype = returning_type;
3098 elog(
ERROR,
"unrecognized RTE kind: %d", (
int)
rte->rtekind);
3116 rtindex, sublevels_up, returning_type,
3133 int rtindex,
int sublevels_up,
3145 for (varattno = 0; varattno < count; varattno++)
3149 if (attr->attisdropped)
3192 attr->atttypid, attr->atttypmod,
3195 varnode->varreturningtype = returning_type;
3216 int sublevels_up,
int location,
3226 foreach(
lc,
nsitem->p_names->colnames)
3232 if (
nscol->p_dontexpand)
3236 else if (colname[0])
3249 var->varnosyn =
nscol->p_varnosyn;
3250 var->varattnosyn =
nscol->p_varattnosyn;
3256 result =
lappend(result, var);
3374 elog(
ERROR,
"invalid attnum %d for rangetable entry %s",
3388 switch (
rte->rtekind)
3402 elog(
ERROR,
"cache lookup failed for attribute %d of relation %u",
3405 result =
att_tup->attisdropped;
3462 foreach(
lc,
rte->functions)
3472 if (rtfunc->funccolnames !=
NIL)
3486 return att->attisdropped;
3501 errmsg(
"column %d of relation \"%s\" does not exist",
3503 rte->eref->aliasname)));
3511 errmsg(
"column %d of relation \"%s\" does not exist",
3513 rte->eref->aliasname)));
3517 elog(
ERROR,
"unrecognized RTE kind: %d", (
int)
rte->rtekind);
3541 if (
tle->resno == resno)
3561 if (rc->
rti == rtindex)
3636 if (
attid >
rd->rd_att->natts)
3658 if (
attid >
rd->rd_att->natts)
3676 if (
attid >
rd->rd_att->natts)
3727 errmsg(
"invalid reference to FROM-clause entry for table \"%s\"",
3729 errhint(
"Perhaps you meant to reference the table alias \"%s\".",
3736 errmsg(
"invalid reference to FROM-clause entry for table \"%s\"",
3738 errdetail(
"There is an entry for table \"%s\", but it cannot be referenced from this part of the query.",
3739 rte->eref->aliasname),
3741 errhint(
"To reference that table, you must mark this subquery with LATERAL.") : 0,
3747 errmsg(
"missing FROM-clause entry for table \"%s\"",
3760 const char *
relname,
const char *colname,
int location)
3786 errmsg(
"column \"%s\" does not exist", colname),
3787 errdetail(
"There are columns named \"%s\", but they are in tables that cannot be referenced from this part of the query.",
3796 errmsg(
"column \"%s\" does not exist", colname),
3797 errdetail(
"There is a column named \"%s\" in table \"%s\", but it cannot be referenced from this part of the query.",
3798 colname,
state->rexact1->eref->aliasname),
3800 errhint(
"To reference that column, you must mark this subquery with LATERAL.") :
3802 errhint(
"To reference that column, you must use a table-qualified name.") : 0,
3806 if (!
state->rsecond)
3814 errmsg(
"column \"%s\" does not exist", colname),
3821 errmsg(
"column \"%s\" does not exist", colname),
3822 errhint(
"Perhaps you meant to reference the column \"%s.%s\".",
3823 state->rfirst->eref->aliasname,
3825 state->first - 1))),
3835 errmsg(
"column \"%s\" does not exist", colname),
3836 errhint(
"Perhaps you meant to reference the column \"%s.%s\" or the column \"%s.%s\".",
3837 state->rfirst->eref->aliasname,
3840 state->rsecond->eref->aliasname,
3842 state->second - 1))),
3854 while (pstate !=
NULL)
3907 return nsitem->p_rel_visible && !
nsitem->p_cols_visible;
3954 if (
rte->perminfoindex == 0 ||
3956 elog(
ERROR,
"invalid perminfoindex %u in RTE with relid %u",
3957 rte->perminfoindex,
rte->relid);
3959 rte->perminfoindex - 1);
3961 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 errmsg(const char *fmt,...)
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)
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 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)