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;
1443 errmsg(
"relation \"%s.%s\" does not exist",
1456 errmsg(
"relation \"%s\" does not exist",
1458 errdetail(
"There is a WITH item named \"%s\", but it cannot be referenced from this part of the query.",
1460 errhint(
"Use WITH RECURSIVE, or re-order the WITH items to remove forward references.")));
1464 errmsg(
"relation \"%s\" does not exist",
1518 rte->rellockmode = lockmode;
1533 rte->lateral =
false;
1603 rte->rellockmode = lockmode;
1618 rte->lateral =
false;
1670 rte->subquery = subquery;
1704 errmsg(
"table \"%s\" has %d columns available but %d columns specified",
1715 rte->lateral = lateral;
1809 rtfunc->funccolnames =
NIL;
1810 rtfunc->funccoltypes =
NIL;
1811 rtfunc->funccoltypmods =
NIL;
1812 rtfunc->funccolcollations =
NIL;
1813 rtfunc->funcparams =
NULL;
1828 if (coldeflist !=
NIL)
1846 errmsg(
"a column definition list is redundant for a function with OUT parameters"),
1852 errmsg(
"a column definition list is redundant for a function returning a named composite type"),
1859 errmsg(
"a column definition list is only allowed for functions returning \"record\""),
1870 errmsg(
"a column definition list is required for functions returning \"record\""),
1907 errmsg(
"column definition lists can have at most %d entries",
1913 foreach(
col, coldeflist)
1925 errmsg(
"column \"%s\" cannot be declared SETOF",
1929 &attrtype, &attrtypmod);
1940 rtfunc->funccolnames =
lappend(rtfunc->funccolnames,
1942 rtfunc->funccoltypes =
lappend_oid(rtfunc->funccoltypes,
1944 rtfunc->funccoltypmods =
lappend_int(rtfunc->funccoltypmods,
1946 rtfunc->funccolcollations =
lappend_oid(rtfunc->funccolcollations,
1967 errmsg(
"function \"%s\" in FROM has unsupported return type %s",
1972 rtfunc->funccolcount = tupdesc->
natts;
1985 if (nfuncs > 1 ||
rangefunc->ordinality)
1994 errmsg(
"functions in FROM can return at most %d columns",
2002 for (
i = 0;
i < nfuncs;
i++)
2037 rte->lateral = lateral;
2079 errmsg(
"functions in FROM can return at most %d columns",
2090 rte->tablefunc = tf;
2091 rte->coltypes = tf->coltypes;
2092 rte->coltypmods = tf->coltypmods;
2093 rte->colcollations = tf->colcollations;
2109 errmsg(
"%s function has %d columns available but %d columns specified",
2121 rte->lateral = lateral;
2136 rte->coltypes,
rte->coltypmods,
2137 rte->colcollations);
2167 rte->values_lists = exprs;
2190 errmsg(
"VALUES lists \"%s\" have %d columns available but %d columns specified",
2201 rte->lateral = lateral;
2216 rte->coltypes,
rte->coltypmods,
2217 rte->colcollations);
2255 errmsg(
"joins can have at most %d columns",
2261 rte->jointype = jointype;
2280 errmsg(
"join expression \"%s\" has %d columns available but %d columns specified",
2291 rte->lateral =
false;
2312 nsitem->p_rel_visible =
true;
2313 nsitem->p_cols_visible =
true;
2314 nsitem->p_lateral_only =
false;
2315 nsitem->p_lateral_ok =
true;
2348 rte->ctelevelsup = levelsup;
2352 Assert(cte->cterecursive || !
rte->self_reference);
2354 if (!
rte->self_reference)
2371 errmsg(
"WITH query \"%s\" does not have a RETURNING clause",
2389 foreach(
lc, cte->ctecolnames)
2398 errmsg(
"table \"%s\" has %d columns available but %d columns specified",
2403 if (cte->search_clause)
2406 if (cte->search_clause->search_breadth_first)
2416 if (cte->cycle_clause)
2420 rte->coltypmods =
lappend_int(
rte->coltypmods, cte->cycle_clause->cycle_mark_typmod);
2421 rte->colcollations =
lappend_oid(
rte->colcollations, cte->cycle_clause->cycle_mark_collation);
2437 rte->lateral =
false;
2452 rte->coltypes,
rte->coltypmods,
2453 rte->colcollations);
2459 if (
rte->ctelevelsup > 0)
2495 switch (
enrmd->enrtype)
2525 rte->colcollations =
NIL;
2526 for (attno = 1; attno <= tupdesc->
natts; ++attno)
2530 if (
att->attisdropped)
2541 elog(
ERROR,
"atttypid is invalid for non-dropped column in \"%s\"",
2556 rte->lateral =
false;
2601 foreach(
lc, groupClauses)
2604 char *colname = te->resname ?
pstrdup(te->resname) :
"?column?";
2619 rte->groupexprs = groupexprs;
2627 rte->lateral =
false;
2628 rte->inFromCl =
false;
2677 if (
lc->lockedRels ==
NIL)
2682 else if (refname !=
NULL)
2687 foreach(l2,
lc->lockedRels)
2722 nsitem->p_lateral_only =
false;
2723 nsitem->p_lateral_ok =
true;
2759 switch (
rte->rtekind)
2764 rtindex, sublevels_up, returning_type, location,
2792 elog(
ERROR,
"too few column names for subquery %s",
2793 rte->eref->aliasname);
2811 varnode->varreturningtype = returning_type;
2827 foreach(
lc,
rte->functions)
2835 if (rtfunc->funccolnames !=
NIL)
2849 rtindex, sublevels_up,
2850 returning_type, location,
2857 *colnames =
lappend(*colnames,
2870 varnode->varreturningtype = returning_type;
2886 rtfunc->funccolcount);
2898 l2, rtfunc->funccoltypmods,
2899 l3, rtfunc->funccolcollations)
2913 varnode->varreturningtype = returning_type;
2922 elog(
ERROR,
"function in FROM has unsupported return type");
2928 if (
rte->funcordinality)
2931 *colnames =
lappend(*colnames,
2943 varnode->varreturningtype = returning_type;
2977 *colnames =
lappend(*colnames,
2998 *colnames =
lappend(*colnames,
3018 varnode->varlevelsup = sublevels_up;
3026 varnode->varreturningtype = returning_type;
3063 *colnames =
lappend(*colnames,
3067 *colnames =
lappend(*colnames,
3082 varnode->varreturningtype = returning_type;
3106 elog(
ERROR,
"unrecognized RTE kind: %d", (
int)
rte->rtekind);
3124 rtindex, sublevels_up, returning_type,
3141 int rtindex,
int sublevels_up,
3153 for (varattno = 0; varattno < count; varattno++)
3157 if (attr->attisdropped)
3200 attr->atttypid, attr->atttypmod,
3203 varnode->varreturningtype = returning_type;
3224 int sublevels_up,
int location,
3234 foreach(
lc,
nsitem->p_names->colnames)
3240 if (
nscol->p_dontexpand)
3244 else if (colname[0])
3257 var->varnosyn =
nscol->p_varnosyn;
3258 var->varattnosyn =
nscol->p_varattnosyn;
3264 result =
lappend(result, var);
3382 elog(
ERROR,
"invalid attnum %d for rangetable entry %s",
3396 switch (
rte->rtekind)
3410 elog(
ERROR,
"cache lookup failed for attribute %d of relation %u",
3413 result =
att_tup->attisdropped;
3470 foreach(
lc,
rte->functions)
3480 if (rtfunc->funccolnames !=
NIL)
3494 return att->attisdropped;
3509 errmsg(
"column %d of relation \"%s\" does not exist",
3511 rte->eref->aliasname)));
3519 errmsg(
"column %d of relation \"%s\" does not exist",
3521 rte->eref->aliasname)));
3525 elog(
ERROR,
"unrecognized RTE kind: %d", (
int)
rte->rtekind);
3549 if (
tle->resno == resno)
3569 if (rc->
rti == rtindex)
3644 if (
attid >
rd->rd_att->natts)
3666 if (
attid >
rd->rd_att->natts)
3684 if (
attid >
rd->rd_att->natts)
3735 errmsg(
"invalid reference to FROM-clause entry for table \"%s\"",
3737 errhint(
"Perhaps you meant to reference the table alias \"%s\".",
3744 errmsg(
"invalid reference to FROM-clause entry for table \"%s\"",
3746 errdetail(
"There is an entry for table \"%s\", but it cannot be referenced from this part of the query.",
3747 rte->eref->aliasname),
3749 errhint(
"To reference that table, you must mark this subquery with LATERAL.") : 0,
3755 errmsg(
"missing FROM-clause entry for table \"%s\"",
3768 const char *
relname,
const char *colname,
int location)
3794 errmsg(
"column \"%s\" does not exist", colname),
3795 errdetail(
"There are columns named \"%s\", but they are in tables that cannot be referenced from this part of the query.",
3804 errmsg(
"column \"%s\" does not exist", colname),
3805 errdetail(
"There is a column named \"%s\" in table \"%s\", but it cannot be referenced from this part of the query.",
3806 colname,
state->rexact1->eref->aliasname),
3808 errhint(
"To reference that column, you must mark this subquery with LATERAL.") :
3810 errhint(
"To reference that column, you must use a table-qualified name.") : 0,
3814 if (!
state->rsecond)
3822 errmsg(
"column \"%s\" does not exist", colname),
3829 errmsg(
"column \"%s\" does not exist", colname),
3830 errhint(
"Perhaps you meant to reference the column \"%s.%s\".",
3831 state->rfirst->eref->aliasname,
3833 state->first - 1))),
3843 errmsg(
"column \"%s\" does not exist", colname),
3844 errhint(
"Perhaps you meant to reference the column \"%s.%s\" or the column \"%s.%s\".",
3845 state->rfirst->eref->aliasname,
3848 state->rsecond->eref->aliasname,
3850 state->second - 1))),
3862 while (pstate !=
NULL)
3915 return nsitem->p_rel_visible && !
nsitem->p_cols_visible;
3962 if (
rte->perminfoindex == 0 ||
3964 elog(
ERROR,
"invalid perminfoindex %u in RTE with relid %u",
3965 rte->perminfoindex,
rte->relid);
3967 rte->perminfoindex - 1);
3969 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 errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#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)
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)
ParseNamespaceItem * addRangeTableEntryForRelation(ParseState *pstate, Relation rel, int lockmode, Alias *alias, bool inh, bool inFromCl)
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)
Relation parserOpenTable(ParseState *pstate, const RangeVar *relation, int lockmode)
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
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(int 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)