34 Var *var,
int levelsup);
53 int sublevels_up,
int location,
291 foreach(l, targetlist)
321 foreach(l, targetlist)
343 Var *var,
int levelsup)
355 switch (
rte->rtekind)
359 tle->resorigtbl =
rte->relid;
363 tle->resorigtbl =
rte->relid;
374 elog(
ERROR,
"subquery %s does not have attribute %d",
376 tle->resorigtbl =
ste->resorigtbl;
377 tle->resorigcol =
ste->resorigcol;
409 if (cte->search_clause)
411 if (cte->cycle_clause)
420 elog(
ERROR,
"CTE %s does not have attribute %d",
422 tle->resorigtbl =
ste->resorigtbl;
423 tle->resorigcol =
ste->resorigcol;
488 errmsg(
"cannot assign to system column \"%s\"",
509 def->typeMod = attrtypmod;
516 errmsg(
"cannot set an array element to DEFAULT"),
521 errmsg(
"cannot set a subfield to DEFAULT"),
588 attrtype, attrtypmod,
595 errmsg(
"column \"%s\" is of type %s"
596 " but expression is of type %s",
600 errhint(
"You will need to rewrite or cast the expression."),
650 tle->resname = colname;
740 errmsg(
"row expansion via \"*\" is not supported here"),
787 errmsg(
"cannot assign to field \"%s\" of column \"%s\" because its type %s is not a composite type",
796 errmsg(
"cannot assign to field \"%s\" of column \"%s\" because there is no such column in data type %s",
803 errmsg(
"cannot assign to system column \"%s\"",
850 return (
Node *) fstore;
885 errmsg(
"subscripted assignment to \"%s\" requires type %s"
886 " but expression is of type %s",
890 errhint(
"You will need to rewrite or cast the expression."),
895 errmsg(
"subfield \"%s\" is of type %s"
896 " but expression is of type %s",
900 errhint(
"You will need to rewrite or cast the expression."),
984 result = (
Node *) sbsref;
1006 errmsg(
"cannot cast type %s to %s",
1043 if (attr->attisdropped)
1075 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
1084 if (
col->indirection ==
NIL)
1091 errmsg(
"column \"%s\" specified more than once",
1102 errmsg(
"column \"%s\" specified more than once",
1163 char *nspname =
NULL;
1246 errmsg(
"column reference \"%s\" is ambiguous",
1267 errmsg(
"cross-database references are not implemented: %s",
1274 errmsg(
"improper qualified name (too many dotted names): %s",
1312 if (!
nsitem->p_cols_visible)
1335 errmsg(
"SELECT * with no tables specified is not valid"),
1485 if (
att->attisdropped)
1584 expr = (
Node *) var;
1586 switch (
rte->rtekind)
1607 elog(
ERROR,
"subquery %s does not have attribute %d",
1625 mypstate.parentParseState = pstate;
1659 if (!
rte->self_reference)
1666 elog(
ERROR,
"CTE %s does not have attribute %d",
1680 for (
Index level = 0;
1684 mypstate.parentParseState = pstate;
1773 foreach(l, ((
ColumnRef *) node)->fields)
1794 foreach(l,
ind->indirection)
1840 *
name =
"merge_action";
1843 switch (((
SubLink *) node)->subLinkType)
1870 *
name = te->resname;
1923 *
name =
"current_date";
1927 *
name =
"current_time";
1931 *
name =
"current_timestamp";
1935 *
name =
"localtime";
1939 *
name =
"localtimestamp";
1942 *
name =
"current_role";
1945 *
name =
"current_user";
1951 *
name =
"session_user";
1954 *
name =
"current_catalog";
1957 *
name =
"current_schema";
1963 switch (((
XmlExpr *) node)->op)
1966 *
name =
"xmlconcat";
1969 *
name =
"xmlelement";
1972 *
name =
"xmlforest";
1984 *
name =
"xmlserialize";
1993 *
name =
"xmlserialize";
2001 *
name =
"json_scalar";
2005 *
name =
"json_serialize";
2009 *
name =
"json_object";
2014 *
name =
"json_array";
2018 *
name =
"json_objectagg";
2022 *
name =
"json_arrayagg";
2029 *
name =
"json_exists";
2032 *
name =
"json_query";
2035 *
name =
"json_value";
2039 elog(
ERROR,
"unrecognized JsonExpr op: %d",
#define InvalidAttrNumber
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_add_member(Bitmapset *a, int x)
#define Assert(condition)
int errcode(int sqlerrcode)
int errhint(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
TupleDesc get_expr_result_tupdesc(Node *expr, bool noError)
List * lappend(List *list, void *datum)
List * list_concat(List *list1, const List *list2)
List * lappend_int(List *list, int datum)
List * list_truncate(List *list, int new_size)
AttrNumber get_attnum(Oid relid, const char *attname)
char * get_database_name(Oid dbid)
Oid get_typcollation(Oid typid)
Oid getBaseTypeAndTypmod(Oid typid, int32 *typmod)
void get_atttypetypmodcoll(Oid relid, AttrNumber attnum, Oid *typid, int32 *typmod, Oid *collid)
Var * makeVar(int varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
Const * makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid)
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
TargetEntry * makeTargetEntry(Expr *expr, AttrNumber resno, char *resname, bool resjunk)
char * pstrdup(const char *in)
char * NameListToString(const List *names)
Oid exprType(const Node *expr)
int32 exprTypmod(const Node *expr)
Oid exprCollation(const Node *expr)
int exprLocation(const Node *expr)
#define IsA(nodeptr, _type_)
Node * coerce_to_domain(Node *arg, Oid baseTypeId, int32 baseTypeMod, Oid typeId, CoercionContext ccontext, CoercionForm cformat, int location, bool hideInputCoercion)
Node * coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod, CoercionContext ccontext, CoercionForm cformat, int location)
Node * coerce_to_target_type(ParseState *pstate, Node *expr, Oid exprtype, Oid targettype, int32 targettypmod, CoercionContext ccontext, CoercionForm cformat, int location)
Node * transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind)
int parser_errposition(ParseState *pstate, int location)
SubscriptingRef * transformContainerSubscripts(ParseState *pstate, Node *containerBase, Oid containerType, int32 containerTypMod, List *indirection, bool isAssignment)
void transformContainerType(Oid *containerType, int32 *containerTypmod)
@ EXPR_KIND_INSERT_TARGET
@ EXPR_KIND_UPDATE_TARGET
@ EXPR_KIND_UPDATE_SOURCE
CommonTableExpr * GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte, int rtelevelsup)
void markVarForSelectPriv(ParseState *pstate, Var *var)
void errorMissingRTE(ParseState *pstate, RangeVar *relation)
TargetEntry * get_tle_by_resno(List *tlist, AttrNumber resno)
List * expandNSItemVars(ParseState *pstate, ParseNamespaceItem *nsitem, int sublevels_up, int location, List **colnames)
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)
Oid attnumTypeId(Relation rd, int attid)
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)
int attnameAttNum(Relation rd, const char *attname, bool sysColOK)
TargetEntry * transformTargetEntry(ParseState *pstate, Node *node, Node *expr, ParseExprKind exprKind, char *colname, bool resjunk)
static List * ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref, bool make_target_entry)
Expr * transformAssignedExpr(ParseState *pstate, Expr *expr, ParseExprKind exprKind, const char *colname, int attrno, List *indirection, int location)
static int FigureColnameInternal(Node *node, char **name)
List * transformExpressionList(ParseState *pstate, List *exprlist, ParseExprKind exprKind, bool allowDefault)
static void markTargetListOrigin(ParseState *pstate, TargetEntry *tle, Var *var, int levelsup)
char * FigureColname(Node *node)
static List * ExpandSingleTable(ParseState *pstate, ParseNamespaceItem *nsitem, int sublevels_up, int location, bool make_target_entry)
char * FigureIndexColname(Node *node)
static Node * transformAssignmentSubscripts(ParseState *pstate, Node *basenode, const char *targetName, Oid targetTypeId, int32 targetTypMod, Oid targetCollation, List *subscripts, List *indirection, ListCell *next_indirection, Node *rhs, CoercionContext ccontext, int location)
static List * ExpandRowReference(ParseState *pstate, Node *expr, bool make_target_entry)
Node * transformAssignmentIndirection(ParseState *pstate, Node *basenode, const char *targetName, bool targetIsSubscripting, Oid targetTypeId, int32 targetTypMod, Oid targetCollation, List *indirection, ListCell *indirection_cell, Node *rhs, CoercionContext ccontext, int location)
void updateTargetListEntry(ParseState *pstate, TargetEntry *tle, char *colname, int attrno, List *indirection, int location)
List * transformTargetList(ParseState *pstate, List *targetlist, ParseExprKind exprKind)
void resolveTargetListUnknowns(ParseState *pstate, List *targetlist)
void markTargetListOrigins(ParseState *pstate, List *targetlist)
static List * ExpandIndirectionStar(ParseState *pstate, A_Indirection *ind, bool make_target_entry, ParseExprKind exprKind)
static List * ExpandAllTables(ParseState *pstate, int location)
List * checkInsertTargets(ParseState *pstate, List *cols, List **attrnos)
TupleDesc expandRecordVariable(ParseState *pstate, Var *var, int levelsup)
Oid typeidTypeRelid(Oid type_id)
#define GetCTETargetList(cte)
FormData_pg_attribute * Form_pg_attribute
static int list_length(const List *l)
#define forboth(cell1, list1, cell2, list2)
#define for_each_cell(cell, lst, initcell)
static void * list_nth(const List *list, int n)
static ListCell * list_head(const List *l)
static ListCell * lnext(const List *l, const ListCell *c)
#define list_make1_int(x1)
@ SVFOP_CURRENT_TIMESTAMP
@ SVFOP_CURRENT_TIMESTAMP_N
#define RelationGetNumberOfAttributes(relation)
#define RelationGetRelationName(relation)
ParseState * parentParseState
ParseNamespaceItem * p_target_nsitem
ParseExprKind p_expr_kind
List * p_multiassign_exprs
PreParseColumnRefHook p_pre_columnref_hook
Relation p_target_relation
PostParseColumnRefHook p_post_columnref_hook
VarReturningType varreturningtype
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)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)