57 #define MAX_FUZZY_DISTANCE 3
69 const char *colname,
int location,
70 int fuzzy_rte_penalty,
75 int rtindex,
int sublevels_up,
76 int location,
bool include_dropped,
79 int count,
int offset,
80 int rtindex,
int sublevels_up,
81 int location,
bool include_dropped,
110 const char *schemaname,
120 if (schemaname != NULL)
140 while (pstate != NULL)
200 (
errcode(ERRCODE_AMBIGUOUS_ALIAS),
201 errmsg(
"table reference \"%s\" is ambiguous",
239 rte->
relid == relid &&
244 (
errcode(ERRCODE_AMBIGUOUS_ALIAS),
245 errmsg(
"table reference %u is ambiguous",
277 if (strcmp(cte->
ctename, refname) == 0)
279 *ctelevelsup = levelsup;
303 if (strcmp(cte->
ctename, refname) == 0)
338 const char *refname = relation->
relname;
342 Index ctelevelsup = 0;
385 strcmp(rte->
ctename, refname) == 0)
389 strcmp(rte->
enrname, refname) == 0)
419 foreach(l1, namespace1)
429 foreach(l2, namespace2)
437 if (strcmp(aliasname2, aliasname1) != 0)
444 (
errcode(ERRCODE_DUPLICATE_ALIAS),
445 errmsg(
"table name \"%s\" specified more than once",
473 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
474 errmsg(
"invalid reference to FROM-clause entry for table \"%s\"",
478 errhint(
"There is an entry for table \"%s\", but it cannot be referenced from this part of the query.",
480 errdetail(
"The combining JOIN type must be INNER or LEFT for a LATERAL reference."),
496 while (sublevels_up-- > 0)
508 elog(
ERROR,
"nsitem not found (internal error)");
521 while (sublevels_up-- > 0)
544 while (levelsup-- > 0)
569 const char *actual,
const char *match,
int attnum)
575 if (fuzzy_rte_penalty > fuzzystate->
distance)
582 if (actual[0] ==
'\0')
586 matchlen = strlen(match);
598 if (columndistance > matchlen / 2)
605 columndistance += fuzzy_rte_penalty;
611 if (columndistance < fuzzystate->distance)
614 fuzzystate->
distance = columndistance;
620 else if (columndistance == fuzzystate->
distance)
632 fuzzystate->
rfirst = NULL;
637 fuzzystate->
distance = columndistance - 1;
669 int sublevels_up,
const char *colname,
int location)
690 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
691 errmsg(
"system column \"%s\" reference in check constraint is invalid",
699 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
700 errmsg(
"cannot use system column \"%s\" in column generation expression",
710 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
711 errmsg(
"cannot use system column \"%s\" in MERGE WHEN condition",
724 (
errcode(ERRCODE_UNDEFINED_COLUMN),
725 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
749 sysatt->attcollation,
787 const char *colname,
int location,
788 int fuzzy_rte_penalty,
813 if (strcmp(attcolname, colname) == 0)
817 (
errcode(ERRCODE_AMBIGUOUS_COLUMN),
818 errmsg(
"column reference \"%s\" is ambiguous",
825 if (fuzzystate != NULL)
827 rte, attcolname, colname,
attnum);
843 rte->
relkind != RELKIND_COMPOSITE_TYPE)
872 int sublevels_up = 0;
875 while (pstate != NULL)
899 (
errcode(ERRCODE_AMBIGUOUS_COLUMN),
900 errmsg(
"column reference \"%s\" is ambiguous",
908 if (result != NULL || localonly)
950 fuzzystate->
rfirst = NULL;
955 while (pstate != NULL)
962 int fuzzy_rte_penalty = 0;
993 fuzzy_rte_penalty, fuzzystate)
994 && fuzzy_rte_penalty == 0)
1045 elog(
ERROR,
"could not find JoinExpr for whole-row reference");
1056 int varno = ((
JoinExpr *)
j->larg)->rtindex;
1061 elog(
ERROR,
"unrecognized node type: %d",
1071 int varno = ((
JoinExpr *)
j->rarg)->rtindex;
1076 elog(
ERROR,
"unrecognized node type: %d",
1127 int maxattrs = tupdesc->
natts;
1151 for (varattno = 0; varattno < maxattrs; varattno++)
1156 if (attr->attisdropped)
1168 aliaslc =
lnext(aliaslist, aliaslc);
1183 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
1184 errmsg(
"table \"%s\" has %d columns available but %d columns specified",
1185 eref->
aliasname, maxattrs - numdropped, numaliases)));
1203 Alias *alias,
int nfuncs)
1223 if (nfuncs == 1 && alias)
1245 int maxattrs = tupdesc->
natts;
1255 for (varattno = 0; varattno < maxattrs; varattno++)
1260 if (attr->attisdropped)
1263 nscolumns[varattno].
p_varno = rtindex;
1264 nscolumns[varattno].
p_varattno = varattno + 1;
1265 nscolumns[varattno].
p_vartype = attr->atttypid;
1266 nscolumns[varattno].
p_vartypmod = attr->atttypmod;
1267 nscolumns[varattno].
p_varcollid = attr->attcollation;
1275 nsitem->
p_rte = rte;
1324 nscolumns[varattno].
p_varno = rtindex;
1325 nscolumns[varattno].
p_varattno = varattno + 1;
1337 nsitem->
p_rte = rte;
1373 errmsg(
"relation \"%s.%s\" does not exist",
1386 errmsg(
"relation \"%s\" does not exist",
1388 errdetail(
"There is a WITH item named \"%s\", but it cannot be referenced from this part of the query.",
1390 errhint(
"Use WITH RECURSIVE, or re-order the WITH items to remove forward references.")));
1394 errmsg(
"relation \"%s\" does not exist",
1609 coltypes = coltypmods = colcollations =
NIL;
1619 if (varattno > numaliases)
1633 if (varattno < numaliases)
1635 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
1636 errmsg(
"table \"%s\" has %d columns available but %d columns specified",
1637 refname, varattno, numaliases)));
1669 coltypes, coltypmods, colcollations);
1730 forthree(lc1, funcexprs, lc2, funcnames, lc3, coldeflists)
1733 char *funcname = (
char *)
lfirst(lc2);
1760 if (coldeflist !=
NIL)
1762 switch (functypclass)
1775 if (
exprType(funcexpr) == RECORDOID)
1777 (
errcode(ERRCODE_SYNTAX_ERROR),
1778 errmsg(
"a column definition list is redundant for a function with OUT parameters"),
1783 (
errcode(ERRCODE_SYNTAX_ERROR),
1784 errmsg(
"a column definition list is redundant for a function returning a named composite type"),
1790 (
errcode(ERRCODE_SYNTAX_ERROR),
1791 errmsg(
"a column definition list is only allowed for functions returning \"record\""),
1801 (
errcode(ERRCODE_SYNTAX_ERROR),
1802 errmsg(
"a column definition list is required for functions returning \"record\""),
1837 foreach(col, coldeflist)
1848 (
errcode(ERRCODE_INVALID_TABLE_DEFINITION),
1849 errmsg(
"column \"%s\" cannot be declared SETOF",
1853 &attrtype, &attrtypmod);
1890 (
errcode(ERRCODE_DATATYPE_MISMATCH),
1891 errmsg(
"function \"%s\" in FROM has unsupported return type %s",
1900 functupdescs[funcno] = tupdesc;
1901 totalatts += tupdesc->
natts;
1917 for (
i = 0;
i < nfuncs;
i++)
1919 for (
j = 1;
j <= functupdescs[
i]->
natts;
j++)
1935 Assert(natts == totalatts);
1940 tupdesc = functupdescs[0];
2020 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2021 errmsg(
"%s function has %d columns available but %d columns specified",
2071 List *colcollations,
2098 while (numaliases < numcolumns)
2103 snprintf(attrname,
sizeof(attrname),
"column%d", numaliases);
2107 if (numcolumns < numaliases)
2109 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2110 errmsg(
"VALUES lists \"%s\" have %d columns available but %d columns specified",
2111 refname, numcolumns, numaliases)));
2164 Alias *join_using_alias,
2181 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
2182 errmsg(
"joins can have at most %d columns",
2206 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2207 errmsg(
"join expression \"%s\" has %d columns available but %d columns specified",
2241 nsitem->
p_rte = rte;
2273 int n_dontexpand_columns = 0;
2301 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2302 errmsg(
"WITH query \"%s\" does not have a RETURNING clause",
2323 if (varattno > numaliases)
2326 if (varattno < numaliases)
2328 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2329 errmsg(
"table \"%s\" has %d columns available but %d columns specified",
2330 refname, varattno, numaliases)));
2344 n_dontexpand_columns += 1;
2359 n_dontexpand_columns += 2;
2398 for (
int i = 0;
i < n_dontexpand_columns;
i++)
2464 for (attno = 1; attno <= tupdesc->
natts; ++attno)
2468 if (att->attisdropped)
2479 elog(
ERROR,
"atttypid is invalid for non-dropped column in \"%s\"",
2556 if (strcmp(refname, thisrel->
relname) == 0)
2573 bool addToRelNameSpace,
bool addToVarNameSpace)
2582 if (addToRelNameSpace || addToVarNameSpace)
2612 int location,
bool include_dropped,
2627 rtindex, sublevels_up, location,
2628 include_dropped, colnames, colvars);
2668 varnode =
makeVar(rtindex, varattno,
2675 *colvars =
lappend(*colvars, varnode);
2705 rtindex, sublevels_up, location,
2706 include_dropped, colnames, colvars);
2712 *colnames =
lappend(*colnames,
2720 varnode =
makeVar(rtindex, atts_done + 1,
2727 *colvars =
lappend(*colvars, varnode);
2768 *colvars =
lappend(*colvars, varnode);
2775 elog(
ERROR,
"function in FROM has unsupported return type");
2784 *colnames =
lappend(*colnames,
2796 *colvars =
lappend(*colvars, varnode);
2826 if (include_dropped)
2829 *colnames =
lappend(*colnames,
2850 *colnames =
lappend(*colnames,
2873 varnode =
makeVar(rtindex, varattno,
2880 *colvars =
lappend(*colvars, varnode);
2914 *colnames =
lappend(*colnames,
2917 else if (include_dropped)
2918 *colnames =
lappend(*colnames,
2930 varnode =
makeVar(rtindex, varattno,
2931 coltype, coltypmod, colcoll,
2935 *colvars =
lappend(*colvars, varnode);
2937 else if (include_dropped)
2964 int location,
bool include_dropped,
2972 rtindex, sublevels_up,
2973 location, include_dropped,
2989 int rtindex,
int sublevels_up,
2990 int location,
bool include_dropped,
2999 Assert(count <= tupdesc->natts);
3000 for (varattno = 0; varattno < count; varattno++)
3004 if (attr->attisdropped)
3006 if (include_dropped)
3046 varnode =
makeVar(rtindex, varattno + offset + 1,
3047 attr->atttypid, attr->atttypmod,
3052 *colvars =
lappend(*colvars, varnode);
3070 int sublevels_up,
int location,
3083 const char *colname =
strVal(colnameval);
3090 else if (colname[0])
3105 result =
lappend(result, var);
3107 *colnames =
lappend(*colnames, colnameval);
3130 int sublevels_up,
bool require_col_privs,
int location)
3162 te_list =
lappend(te_list, te);
3164 if (require_col_privs)
3216 elog(
ERROR,
"invalid attnum %d for rangetable entry %s",
3244 elog(
ERROR,
"cache lookup failed for attribute %d of relation %u",
3247 result = att_tup->attisdropped;
3287 result = (aliasvar == NULL);
3307 if (
attnum > atts_done &&
3308 attnum <= atts_done + rtfunc->funccolcount)
3323 return att_tup->attisdropped;
3337 (
errcode(ERRCODE_UNDEFINED_COLUMN),
3338 errmsg(
"column %d of relation \"%s\" does not exist",
3347 (
errcode(ERRCODE_UNDEFINED_COLUMN),
3348 errmsg(
"column %d of relation \"%s\" does not exist",
3378 if (tle->
resno == resno)
3398 if (rc->
rti == rtindex)
3451 return sysatt->attnum;
3471 return &sysatt->attname;
3474 elog(
ERROR,
"invalid attribute number %d", attid);
3493 return sysatt->atttypid;
3496 elog(
ERROR,
"invalid attribute number %d", attid);
3514 elog(
ERROR,
"invalid attribute number %d", attid);
3528 const char *badAlias = NULL;
3547 if (rte && rte->
alias &&
3556 if (nsitem && nsitem->
p_rte == rte)
3563 errmsg(
"invalid reference to FROM-clause entry for table \"%s\"",
3566 errhint(
"Perhaps you meant to reference the table alias \"%s\".",
3568 errhint(
"There is an entry for table \"%s\", but it cannot be referenced from this part of the query.",
3574 errmsg(
"missing FROM-clause entry for table \"%s\"",
3587 const char *
relname,
const char *colname,
int location)
3590 char *closestfirst = NULL;
3614 if (!
state->rsecond)
3621 (
errcode(ERRCODE_UNDEFINED_COLUMN),
3624 errmsg(
"column \"%s\" does not exist", colname),
3625 state->rfirst ? closestfirst ?
3626 errhint(
"Perhaps you meant to reference the column \"%s.%s\".",
3627 state->rfirst->eref->aliasname, closestfirst) :
3628 errhint(
"There is a column named \"%s\" in table \"%s\", but it cannot be referenced from this part of the query.",
3629 colname,
state->rfirst->eref->aliasname) : 0,
3635 char *closestsecond;
3638 state->second - 1));
3641 (
errcode(ERRCODE_UNDEFINED_COLUMN),
3644 errmsg(
"column \"%s\" does not exist", colname),
3645 errhint(
"Perhaps you meant to reference the column \"%s.%s\" or the column \"%s.%s\".",
3646 state->rfirst->eref->aliasname, closestfirst,
3647 state->rsecond->eref->aliasname, closestsecond),
3674 foreach(rtable, query->
rtable)
3681 char relpersistence = rel->
rd_rel->relpersistence;
3684 if (relpersistence == RELPERSISTENCE_TEMP)
#define AttributeNumberIsValid(attributeNumber)
#define InvalidAttrNumber
Bitmapset * bms_add_member(Bitmapset *a, int x)
#define OidIsValid(objectId)
elog(ERROR, "%s: %s", p2, msg)
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
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 * SystemAttributeDefinition(AttrNumber attno)
void CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind, int flags)
const FormData_pg_attribute * SystemAttributeByName(const char *attname)
#define CHKATYPE_ANYRECORD
#define HeapTupleIsValid(tuple)
if(TABLE==NULL||TABLE_index==NULL)
Assert(fmt[strlen(fmt) - 1] !='\n')
List * list_truncate(List *list, int new_size)
List * lappend(List *list, void *datum)
List * lappend_int(List *list, int datum)
List * lappend_oid(List *list, Oid datum)
List * list_copy(const List *oldlist)
List * list_copy_tail(const List *oldlist, int nskip)
List * list_concat(List *list1, const List *list2)
bool CheckRelationLockedByMe(Relation relation, LOCKMODE lockmode, bool orstronger)
Oid get_relname_relid(const char *relname, Oid relnamespace)
char * get_attname(Oid relid, AttrNumber attnum, bool missing_ok)
Alias * makeAlias(const char *aliasname, List *colnames)
TargetEntry * makeTargetEntry(Expr *expr, AttrNumber resno, char *resname, bool resjunk)
Const * makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid)
Var * makeVar(int varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
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)
bool query_tree_walker(Query *query, bool(*walker)(), void *context, int flags)
Oid exprType(const Node *expr)
int32 exprTypmod(const Node *expr)
Oid exprCollation(const Node *expr)
bool expression_tree_walker(Node *node, bool(*walker)(), void *context)
int exprLocation(const Node *expr)
#define QTW_IGNORE_JOINALIASES
#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 void expandRelation(Oid relid, Alias *eref, int rtindex, int sublevels_up, int location, bool include_dropped, List **colnames, List **colvars)
ParseNamespaceItem * addRangeTableEntryForCTE(ParseState *pstate, CommonTableExpr *cte, Index levelsup, RangeVar *rv, bool inFromCl)
RangeTblEntry * GetRTEByRangeTablePosn(ParseState *pstate, int varno, int sublevels_up)
static void expandTupleDesc(TupleDesc tupdesc, Alias *eref, int count, int offset, int rtindex, int sublevels_up, int location, bool include_dropped, List **colnames, List **colvars)
ParseNamespaceItem * addRangeTableEntry(ParseState *pstate, RangeVar *relation, Alias *alias, bool inh, bool inFromCl)
void errorMissingColumn(ParseState *pstate, const char *relname, const char *colname, int location)
static int specialAttNum(const char *attname)
static ParseNamespaceItem * scanNameSpaceForRelid(ParseState *pstate, Oid relid, int location)
static FuzzyAttrMatchState * searchRangeTableForCol(ParseState *pstate, const char *alias, const char *colname, int location)
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)
Oid attnumCollationId(Relation rd, int attid)
void markVarForSelectPriv(ParseState *pstate, Var *var)
RowMarkClause * get_parse_rowmark(Query *qry, Index rtindex)
CommonTableExpr * scanNameSpaceForCTE(ParseState *pstate, const char *refname, Index *ctelevelsup)
static RangeTblEntry * searchRangeTableForRel(ParseState *pstate, RangeVar *relation)
ParseNamespaceItem * addRangeTableEntryForRelation(ParseState *pstate, Relation rel, int lockmode, Alias *alias, bool inh, bool inFromCl)
static ParseNamespaceItem * scanNameSpaceForRefname(ParseState *pstate, const char *refname, int location)
void errorMissingRTE(ParseState *pstate, RangeVar *relation)
static bool isFutureCTE(ParseState *pstate, const char *refname)
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)
const NameData * attnumAttName(Relation rd, int attid)
Relation parserOpenTable(ParseState *pstate, const RangeVar *relation, int lockmode)
TargetEntry * get_tle_by_resno(List *tlist, AttrNumber resno)
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 * GetNSItemByRangeTablePosn(ParseState *pstate, int varno, int sublevels_up)
static ParseNamespaceItem * buildNSItemFromTupleDesc(RangeTblEntry *rte, Index rtindex, TupleDesc tupdesc)
ParseNamespaceItem * addRangeTableEntryForSubquery(ParseState *pstate, Query *subquery, Alias *alias, bool lateral, bool inFromCl)
Node * scanNSItemForColumn(ParseState *pstate, ParseNamespaceItem *nsitem, int sublevels_up, const char *colname, int location)
ParseNamespaceItem * refnameNamespaceItem(ParseState *pstate, const char *schemaname, const char *refname, int location, int *sublevels_up)
char * get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum)
bool scanNameSpaceForENR(ParseState *pstate, const char *refname)
bool isLockedRefname(ParseState *pstate, const char *refname)
Oid attnumTypeId(Relation rd, int attid)
ParseNamespaceItem * addRangeTableEntryForFunction(ParseState *pstate, List *funcnames, List *funcexprs, List *coldeflists, RangeFunction *rangefunc, bool lateral, bool inFromCl)
Node * colNameToVar(ParseState *pstate, const char *colname, bool localonly, int location)
static void markRTEForSelectPriv(ParseState *pstate, int rtindex, AttrNumber col)
ParseNamespaceItem * addRangeTableEntryForTableFunc(ParseState *pstate, TableFunc *tf, Alias *alias, bool lateral, bool inFromCl)
ParseNamespaceItem * addRangeTableEntryForValues(ParseState *pstate, List *exprs, List *coltypes, List *coltypmods, List *colcollations, Alias *alias, bool lateral, bool inFromCl)
static char * chooseScalarFunctionAlias(Node *funcexpr, char *funcname, Alias *alias, int nfuncs)
static ParseNamespaceItem * buildNSItemFromLists(RangeTblEntry *rte, Index rtindex, List *coltypes, List *coltypmods, List *colcollations)
List * expandNSItemAttrs(ParseState *pstate, ParseNamespaceItem *nsitem, int sublevels_up, bool require_col_privs, int location)
List * expandNSItemVars(ParseNamespaceItem *nsitem, int sublevels_up, int location, List **colnames)
bool isQueryUsingTempRelation(Query *query)
ParseNamespaceItem * addRangeTableEntryForENR(ParseState *pstate, RangeVar *rv, bool inFromCl)
void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up, int location, bool include_dropped, List **colnames, List **colvars)
CommonTableExpr * GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte, int rtelevelsup)
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 void check_lateral_ref_ok(ParseState *pstate, ParseNamespaceItem *nsitem, int location)
static bool isQueryUsingTempRelation_walker(Node *node, void *context)
void typenameTypeIdAndMod(ParseState *pstate, const TypeName *typeName, Oid *typeid_p, int32 *typmod_p)
Oid GetColumnDefCollation(ParseState *pstate, 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 ListCell * list_head(const List *l)
static ListCell * list_nth_cell(const List *list, int n)
static void * list_nth(const List *list, int n)
#define list_nth_node(type, list, n)
static ListCell * lnext(const List *l, const ListCell *c)
#define ERRCODE_UNDEFINED_TABLE
#define ObjectIdGetDatum(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)
bool search_breadth_first
CTECycleClause * cycle_clause
CTESearchClause * search_clause
ParseNamespaceColumn * p_nscolumns
ParseState * parentParseState
ParseNamespaceItem * p_target_nsitem
ParseExprKind p_expr_kind
bool p_locked_from_parent
Bitmapset * extraUpdatedCols
#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_open(Oid relationId, 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)
#define TupleDescAttr(tupdesc, 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)