PostgreSQL Source Code  git master
parse_target.h File Reference
Include dependency graph for parse_target.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ListtransformTargetList (ParseState *pstate, List *targetlist, ParseExprKind exprKind)
 
ListtransformExpressionList (ParseState *pstate, List *exprlist, ParseExprKind exprKind, bool allowDefault)
 
void resolveTargetListUnknowns (ParseState *pstate, List *targetlist)
 
void markTargetListOrigins (ParseState *pstate, List *targetlist)
 
TargetEntrytransformTargetEntry (ParseState *pstate, Node *node, Node *expr, ParseExprKind exprKind, char *colname, bool resjunk)
 
ExprtransformAssignedExpr (ParseState *pstate, Expr *expr, ParseExprKind exprKind, const char *colname, int attrno, List *indirection, int location)
 
void updateTargetListEntry (ParseState *pstate, TargetEntry *tle, char *colname, int attrno, List *indirection, int location)
 
NodetransformAssignmentIndirection (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)
 
ListcheckInsertTargets (ParseState *pstate, List *cols, List **attrnos)
 
TupleDesc expandRecordVariable (ParseState *pstate, Var *var, int levelsup)
 
char * FigureColname (Node *node)
 
char * FigureIndexColname (Node *node)
 

Function Documentation

◆ checkInsertTargets()

List* checkInsertTargets ( ParseState pstate,
List cols,
List **  attrnos 
)

Definition at line 1012 of file parse_target.c.

References attnameAttNum(), bms_add_member(), bms_is_member(), ereport, errcode(), errmsg(), ERROR, i, ResTarget::indirection, InvalidAttrNumber, lappend(), lappend_int(), lfirst, ResTarget::location, makeNode, ResTarget::name, name, NameStr, NIL, ParseState::p_target_relation, parser_errposition(), pstrdup(), RelationData::rd_att, RelationGetNumberOfAttributes, RelationGetRelationName, TupleDescAttr, and ResTarget::val.

Referenced by transformInsertStmt().

1013 {
1014  *attrnos = NIL;
1015 
1016  if (cols == NIL)
1017  {
1018  /*
1019  * Generate default column list for INSERT.
1020  */
1021  int numcol = RelationGetNumberOfAttributes(pstate->p_target_relation);
1022 
1023  int i;
1024 
1025  for (i = 0; i < numcol; i++)
1026  {
1027  ResTarget *col;
1028  Form_pg_attribute attr;
1029 
1030  attr = TupleDescAttr(pstate->p_target_relation->rd_att, i);
1031 
1032  if (attr->attisdropped)
1033  continue;
1034 
1035  col = makeNode(ResTarget);
1036  col->name = pstrdup(NameStr(attr->attname));
1037  col->indirection = NIL;
1038  col->val = NULL;
1039  col->location = -1;
1040  cols = lappend(cols, col);
1041  *attrnos = lappend_int(*attrnos, i + 1);
1042  }
1043  }
1044  else
1045  {
1046  /*
1047  * Do initial validation of user-supplied INSERT column list.
1048  */
1049  Bitmapset *wholecols = NULL;
1050  Bitmapset *partialcols = NULL;
1051  ListCell *tl;
1052 
1053  foreach(tl, cols)
1054  {
1055  ResTarget *col = (ResTarget *) lfirst(tl);
1056  char *name = col->name;
1057  int attrno;
1058 
1059  /* Lookup column name, ereport on failure */
1060  attrno = attnameAttNum(pstate->p_target_relation, name, false);
1061  if (attrno == InvalidAttrNumber)
1062  ereport(ERROR,
1063  (errcode(ERRCODE_UNDEFINED_COLUMN),
1064  errmsg("column \"%s\" of relation \"%s\" does not exist",
1065  name,
1067  parser_errposition(pstate, col->location)));
1068 
1069  /*
1070  * Check for duplicates, but only of whole columns --- we allow
1071  * INSERT INTO foo (col.subcol1, col.subcol2)
1072  */
1073  if (col->indirection == NIL)
1074  {
1075  /* whole column; must not have any other assignment */
1076  if (bms_is_member(attrno, wholecols) ||
1077  bms_is_member(attrno, partialcols))
1078  ereport(ERROR,
1079  (errcode(ERRCODE_DUPLICATE_COLUMN),
1080  errmsg("column \"%s\" specified more than once",
1081  name),
1082  parser_errposition(pstate, col->location)));
1083  wholecols = bms_add_member(wholecols, attrno);
1084  }
1085  else
1086  {
1087  /* partial column; must not have any whole assignment */
1088  if (bms_is_member(attrno, wholecols))
1089  ereport(ERROR,
1090  (errcode(ERRCODE_DUPLICATE_COLUMN),
1091  errmsg("column \"%s\" specified more than once",
1092  name),
1093  parser_errposition(pstate, col->location)));
1094  partialcols = bms_add_member(partialcols, attrno);
1095  }
1096 
1097  *attrnos = lappend_int(*attrnos, attrno);
1098  }
1099  }
1100 
1101  return cols;
1102 }
List * indirection
Definition: parsenodes.h:442
#define NIL
Definition: pg_list.h:65
Node * val
Definition: parsenodes.h:443
char * name
Definition: parsenodes.h:441
#define RelationGetNumberOfAttributes(relation)
Definition: rel.h:463
#define TupleDescAttr(tupdesc, i)
Definition: tupdesc.h:92
char * pstrdup(const char *in)
Definition: mcxt.c:1187
int errcode(int sqlerrcode)
Definition: elog.c:704
int location
Definition: parsenodes.h:444
#define ERROR
Definition: elog.h:45
#define RelationGetRelationName(relation)
Definition: rel.h:491
FormData_pg_attribute * Form_pg_attribute
Definition: pg_attribute.h:197
List * lappend_int(List *list, int datum)
Definition: list.c:354
List * lappend(List *list, void *datum)
Definition: list.c:336
TupleDesc rd_att
Definition: rel.h:111
#define ereport(elevel,...)
Definition: elog.h:155
#define makeNode(_type_)
Definition: nodes.h:581
int attnameAttNum(Relation rd, const char *attname, bool sysColOK)
#define lfirst(lc)
Definition: pg_list.h:169
int parser_errposition(ParseState *pstate, int location)
Definition: parse_node.c:111
Bitmapset * bms_add_member(Bitmapset *a, int x)
Definition: bitmapset.c:736
const char * name
Definition: encode.c:515
#define InvalidAttrNumber
Definition: attnum.h:23
int errmsg(const char *fmt,...)
Definition: elog.c:915
Relation p_target_relation
Definition: parse_node.h:191
int i
#define NameStr(name)
Definition: c.h:681
bool bms_is_member(int x, const Bitmapset *a)
Definition: bitmapset.c:427

◆ expandRecordVariable()

TupleDesc expandRecordVariable ( ParseState pstate,
Var var,
int  levelsup 
)

Definition at line 1510 of file parse_target.c.

References Alias::aliasname, Assert, attnum, CreateTemplateTupleDesc(), RangeTblEntry::ctelevelsup, CommonTableExpr::ctequery, elog, RangeTblEntry::eref, ERROR, expandRecordVariable(), expandRTE(), TargetEntry::expr, exprCollation(), exprType(), exprTypmod(), forboth, get_expr_result_tupdesc(), get_tle_by_resno(), GetCTEForRTE(), GetCTETargetList, GetRTEByRangeTablePosn(), i, InvalidAttrNumber, IsA, RangeTblEntry::joinaliasvars, label, lfirst, list_length(), list_nth(), Var::location, MemSet, ParseState::p_rtable, ParseState::parentParseState, TargetEntry::resjunk, Query::rtable, RTE_CTE, RTE_FUNCTION, RTE_JOIN, RTE_NAMEDTUPLESTORE, RTE_RELATION, RTE_RESULT, RTE_SUBQUERY, RTE_TABLEFUNC, RTE_VALUES, RangeTblEntry::rtekind, RangeTblEntry::self_reference, strVal, RangeTblEntry::subquery, Query::targetList, TupleDescInitEntry(), TupleDescInitEntryCollation(), Var::varattno, Var::varlevelsup, Var::varno, and Var::vartype.

Referenced by expandRecordVariable(), ExpandRowReference(), and ParseComplexProjection().

1511 {
1512  TupleDesc tupleDesc;
1513  int netlevelsup;
1514  RangeTblEntry *rte;
1516  Node *expr;
1517 
1518  /* Check my caller didn't mess up */
1519  Assert(IsA(var, Var));
1520  Assert(var->vartype == RECORDOID);
1521 
1522  /*
1523  * Note: it's tempting to use GetNSItemByRangeTablePosn here so that we
1524  * can use expandNSItemVars instead of expandRTE; but that does not work
1525  * for some of the recursion cases below, where we have consed up a
1526  * ParseState that lacks p_namespace data.
1527  */
1528  netlevelsup = var->varlevelsup + levelsup;
1529  rte = GetRTEByRangeTablePosn(pstate, var->varno, netlevelsup);
1530  attnum = var->varattno;
1531 
1532  if (attnum == InvalidAttrNumber)
1533  {
1534  /* Whole-row reference to an RTE, so expand the known fields */
1535  List *names,
1536  *vars;
1537  ListCell *lname,
1538  *lvar;
1539  int i;
1540 
1541  expandRTE(rte, var->varno, 0, var->location, false,
1542  &names, &vars);
1543 
1544  tupleDesc = CreateTemplateTupleDesc(list_length(vars));
1545  i = 1;
1546  forboth(lname, names, lvar, vars)
1547  {
1548  char *label = strVal(lfirst(lname));
1549  Node *varnode = (Node *) lfirst(lvar);
1550 
1551  TupleDescInitEntry(tupleDesc, i,
1552  label,
1553  exprType(varnode),
1554  exprTypmod(varnode),
1555  0);
1556  TupleDescInitEntryCollation(tupleDesc, i,
1557  exprCollation(varnode));
1558  i++;
1559  }
1560  Assert(lname == NULL && lvar == NULL); /* lists same length? */
1561 
1562  return tupleDesc;
1563  }
1564 
1565  expr = (Node *) var; /* default if we can't drill down */
1566 
1567  switch (rte->rtekind)
1568  {
1569  case RTE_RELATION:
1570  case RTE_VALUES:
1571  case RTE_NAMEDTUPLESTORE:
1572  case RTE_RESULT:
1573 
1574  /*
1575  * This case should not occur: a column of a table, values list,
1576  * or ENR shouldn't have type RECORD. Fall through and fail (most
1577  * likely) at the bottom.
1578  */
1579  break;
1580  case RTE_SUBQUERY:
1581  {
1582  /* Subselect-in-FROM: examine sub-select's output expr */
1584  attnum);
1585 
1586  if (ste == NULL || ste->resjunk)
1587  elog(ERROR, "subquery %s does not have attribute %d",
1588  rte->eref->aliasname, attnum);
1589  expr = (Node *) ste->expr;
1590  if (IsA(expr, Var))
1591  {
1592  /*
1593  * Recurse into the sub-select to see what its Var refers
1594  * to. We have to build an additional level of ParseState
1595  * to keep in step with varlevelsup in the subselect.
1596  */
1597  ParseState mypstate;
1598 
1599  MemSet(&mypstate, 0, sizeof(mypstate));
1600  mypstate.parentParseState = pstate;
1601  mypstate.p_rtable = rte->subquery->rtable;
1602  /* don't bother filling the rest of the fake pstate */
1603 
1604  return expandRecordVariable(&mypstate, (Var *) expr, 0);
1605  }
1606  /* else fall through to inspect the expression */
1607  }
1608  break;
1609  case RTE_JOIN:
1610  /* Join RTE --- recursively inspect the alias variable */
1611  Assert(attnum > 0 && attnum <= list_length(rte->joinaliasvars));
1612  expr = (Node *) list_nth(rte->joinaliasvars, attnum - 1);
1613  Assert(expr != NULL);
1614  /* We intentionally don't strip implicit coercions here */
1615  if (IsA(expr, Var))
1616  return expandRecordVariable(pstate, (Var *) expr, netlevelsup);
1617  /* else fall through to inspect the expression */
1618  break;
1619  case RTE_FUNCTION:
1620 
1621  /*
1622  * We couldn't get here unless a function is declared with one of
1623  * its result columns as RECORD, which is not allowed.
1624  */
1625  break;
1626  case RTE_TABLEFUNC:
1627 
1628  /*
1629  * Table function cannot have columns with RECORD type.
1630  */
1631  break;
1632  case RTE_CTE:
1633  /* CTE reference: examine subquery's output expr */
1634  if (!rte->self_reference)
1635  {
1636  CommonTableExpr *cte = GetCTEForRTE(pstate, rte, netlevelsup);
1637  TargetEntry *ste;
1638 
1639  ste = get_tle_by_resno(GetCTETargetList(cte), attnum);
1640  if (ste == NULL || ste->resjunk)
1641  elog(ERROR, "CTE %s does not have attribute %d",
1642  rte->eref->aliasname, attnum);
1643  expr = (Node *) ste->expr;
1644  if (IsA(expr, Var))
1645  {
1646  /*
1647  * Recurse into the CTE to see what its Var refers to. We
1648  * have to build an additional level of ParseState to keep
1649  * in step with varlevelsup in the CTE; furthermore it
1650  * could be an outer CTE.
1651  */
1652  ParseState mypstate;
1653  Index levelsup;
1654 
1655  MemSet(&mypstate, 0, sizeof(mypstate));
1656  /* this loop must work, since GetCTEForRTE did */
1657  for (levelsup = 0;
1658  levelsup < rte->ctelevelsup + netlevelsup;
1659  levelsup++)
1660  pstate = pstate->parentParseState;
1661  mypstate.parentParseState = pstate;
1662  mypstate.p_rtable = ((Query *) cte->ctequery)->rtable;
1663  /* don't bother filling the rest of the fake pstate */
1664 
1665  return expandRecordVariable(&mypstate, (Var *) expr, 0);
1666  }
1667  /* else fall through to inspect the expression */
1668  }
1669  break;
1670  }
1671 
1672  /*
1673  * We now have an expression we can't expand any more, so see if
1674  * get_expr_result_tupdesc() can do anything with it.
1675  */
1676  return get_expr_result_tupdesc(expr, false);
1677 }
#define IsA(nodeptr, _type_)
Definition: nodes.h:584
List * joinaliasvars
Definition: parsenodes.h:1056
Index varlevelsup
Definition: primnodes.h:191
#define forboth(cell1, list1, cell2, list2)
Definition: pg_list.h:446
TupleDesc CreateTemplateTupleDesc(int natts)
Definition: tupdesc.c:44
int32 exprTypmod(const Node *expr)
Definition: nodeFuncs.c:267
ParseState * parentParseState
Definition: parse_node.h:179
CommonTableExpr * GetCTEForRTE(ParseState *pstate, RangeTblEntry *rte, int rtelevelsup)
Definition: nodes.h:533
#define strVal(v)
Definition: value.h:54
#define MemSet(start, val, len)
Definition: c.h:1008
AttrNumber varattno
Definition: primnodes.h:186
Definition: primnodes.h:181
List * targetList
Definition: parsenodes.h:140
bool resjunk
Definition: primnodes.h:1438
List * rtable
Definition: parsenodes.h:137
#define ERROR
Definition: elog.h:45
TupleDesc get_expr_result_tupdesc(Node *expr, bool noError)
Definition: funcapi.c:440
static void * list_nth(const List *list, int n)
Definition: pg_list.h:278
Oid vartype
Definition: primnodes.h:188
void TupleDescInitEntryCollation(TupleDesc desc, AttrNumber attributeNumber, Oid collationid)
Definition: tupdesc.c:769
int location
Definition: primnodes.h:196
TupleDesc expandRecordVariable(ParseState *pstate, Var *var, int levelsup)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
Definition: tupdesc.c:603
Index varno
Definition: primnodes.h:184
void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up, int location, bool include_dropped, List **colnames, List **colvars)
bool self_reference
Definition: parsenodes.h:1086
static char * label
RangeTblEntry * GetRTEByRangeTablePosn(ParseState *pstate, int varno, int sublevels_up)
unsigned int Index
Definition: c.h:549
int16 attnum
Definition: pg_attribute.h:83
#define Assert(condition)
Definition: c.h:804
#define lfirst(lc)
Definition: pg_list.h:169
char * aliasname
Definition: primnodes.h:42
Expr * expr
Definition: primnodes.h:1431
Oid exprType(const Node *expr)
Definition: nodeFuncs.c:41
static int list_length(const List *l)
Definition: pg_list.h:149
Oid exprCollation(const Node *expr)
Definition: nodeFuncs.c:759
Index ctelevelsup
Definition: parsenodes.h:1085
#define InvalidAttrNumber
Definition: attnum.h:23
RTEKind rtekind
Definition: parsenodes.h:981
Query * subquery
Definition: parsenodes.h:1016
#define elog(elevel,...)
Definition: elog.h:228
int i
TargetEntry * get_tle_by_resno(List *tlist, AttrNumber resno)
Alias * eref
Definition: parsenodes.h:1120
Definition: regcomp.c:238
Definition: pg_list.h:50
#define GetCTETargetList(cte)
Definition: parsenodes.h:1498
int16 AttrNumber
Definition: attnum.h:21
List * p_rtable
Definition: parse_node.h:181

◆ FigureColname()

char* FigureColname ( Node node)

Definition at line 1690 of file parse_target.c.

References FigureColnameInternal(), and name.

Referenced by transformRangeFunction(), transformTargetEntry(), and transformXmlExpr().

1691 {
1692  char *name = NULL;
1693 
1694  (void) FigureColnameInternal(node, &name);
1695  if (name != NULL)
1696  return name;
1697  /* default result if we can't guess anything */
1698  return "?column?";
1699 }
static int FigureColnameInternal(Node *node, char **name)
const char * name
Definition: encode.c:515

◆ FigureIndexColname()

char* FigureIndexColname ( Node node)

Definition at line 1709 of file parse_target.c.

References FigureColnameInternal(), and name.

Referenced by transformIndexStmt().

1710 {
1711  char *name = NULL;
1712 
1713  (void) FigureColnameInternal(node, &name);
1714  return name;
1715 }
static int FigureColnameInternal(Node *node, char **name)
const char * name
Definition: encode.c:515

◆ markTargetListOrigins()

void markTargetListOrigins ( ParseState pstate,
List targetlist 
)

Definition at line 321 of file parse_target.c.

References TargetEntry::expr, lfirst, and markTargetListOrigin().

Referenced by transformReturningList(), and transformSelectStmt().

322 {
323  ListCell *l;
324 
325  foreach(l, targetlist)
326  {
327  TargetEntry *tle = (TargetEntry *) lfirst(l);
328 
329  markTargetListOrigin(pstate, tle, (Var *) tle->expr, 0);
330  }
331 }
Definition: primnodes.h:181
#define lfirst(lc)
Definition: pg_list.h:169
Expr * expr
Definition: primnodes.h:1431
static void markTargetListOrigin(ParseState *pstate, TargetEntry *tle, Var *var, int levelsup)
Definition: parse_target.c:346

◆ resolveTargetListUnknowns()

void resolveTargetListUnknowns ( ParseState pstate,
List targetlist 
)

Definition at line 291 of file parse_target.c.

References COERCE_IMPLICIT_CAST, coerce_type(), COERCION_IMPLICIT, TargetEntry::expr, exprType(), and lfirst.

Referenced by transformReturningList(), and transformSelectStmt().

292 {
293  ListCell *l;
294 
295  foreach(l, targetlist)
296  {
297  TargetEntry *tle = (TargetEntry *) lfirst(l);
298  Oid restype = exprType((Node *) tle->expr);
299 
300  if (restype == UNKNOWNOID)
301  {
302  tle->expr = (Expr *) coerce_type(pstate, (Node *) tle->expr,
303  restype, TEXTOID, -1,
306  -1);
307  }
308  }
309 }
Node * coerce_type(ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod, CoercionContext ccontext, CoercionForm cformat, int location)
Definition: parse_coerce.c:156
Definition: nodes.h:533
unsigned int Oid
Definition: postgres_ext.h:31
#define lfirst(lc)
Definition: pg_list.h:169
Expr * expr
Definition: primnodes.h:1431
Oid exprType(const Node *expr)
Definition: nodeFuncs.c:41

◆ transformAssignedExpr()

Expr* transformAssignedExpr ( ParseState pstate,
Expr expr,
ParseExprKind  exprKind,
const char *  colname,
int  attrno,
List indirection,
int  location 
)

Definition at line 455 of file parse_target.c.

References Assert, attnumTypeId(), COERCE_IMPLICIT_CAST, coerce_to_target_type(), COERCION_ASSIGNMENT, SetToDefault::collation, ereport, errcode(), errhint(), errmsg(), ERROR, EXPR_KIND_NONE, exprLocation(), exprType(), format_type_be(), IsA, linitial, list_head(), Var::location, makeNullConst(), makeVar(), ParseState::p_expr_kind, ParseState::p_is_insert, ParseNamespaceItem::p_rtindex, ParseState::p_target_nsitem, ParseState::p_target_relation, parser_errposition(), RelationData::rd_att, transformAssignmentIndirection(), TupleDescAttr, SetToDefault::typeId, and SetToDefault::typeMod.

Referenced by transformInsertRow(), and updateTargetListEntry().

462 {
463  Relation rd = pstate->p_target_relation;
464  Oid type_id; /* type of value provided */
465  Oid attrtype; /* type of target column */
466  int32 attrtypmod;
467  Oid attrcollation; /* collation of target column */
468  ParseExprKind sv_expr_kind;
469 
470  /*
471  * Save and restore identity of expression type we're parsing. We must
472  * set p_expr_kind here because we can parse subscripts without going
473  * through transformExpr().
474  */
475  Assert(exprKind != EXPR_KIND_NONE);
476  sv_expr_kind = pstate->p_expr_kind;
477  pstate->p_expr_kind = exprKind;
478 
479  Assert(rd != NULL);
480  if (attrno <= 0)
481  ereport(ERROR,
482  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
483  errmsg("cannot assign to system column \"%s\"",
484  colname),
485  parser_errposition(pstate, location)));
486  attrtype = attnumTypeId(rd, attrno);
487  attrtypmod = TupleDescAttr(rd->rd_att, attrno - 1)->atttypmod;
488  attrcollation = TupleDescAttr(rd->rd_att, attrno - 1)->attcollation;
489 
490  /*
491  * If the expression is a DEFAULT placeholder, insert the attribute's
492  * type/typmod/collation into it so that exprType etc will report the
493  * right things. (We expect that the eventually substituted default
494  * expression will in fact have this type and typmod. The collation
495  * likely doesn't matter, but let's set it correctly anyway.) Also,
496  * reject trying to update a subfield or array element with DEFAULT, since
497  * there can't be any default for portions of a column.
498  */
499  if (expr && IsA(expr, SetToDefault))
500  {
501  SetToDefault *def = (SetToDefault *) expr;
502 
503  def->typeId = attrtype;
504  def->typeMod = attrtypmod;
505  def->collation = attrcollation;
506  if (indirection)
507  {
508  if (IsA(linitial(indirection), A_Indices))
509  ereport(ERROR,
510  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
511  errmsg("cannot set an array element to DEFAULT"),
512  parser_errposition(pstate, location)));
513  else
514  ereport(ERROR,
515  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
516  errmsg("cannot set a subfield to DEFAULT"),
517  parser_errposition(pstate, location)));
518  }
519  }
520 
521  /* Now we can use exprType() safely. */
522  type_id = exprType((Node *) expr);
523 
524  /*
525  * If there is indirection on the target column, prepare an array or
526  * subfield assignment expression. This will generate a new column value
527  * that the source value has been inserted into, which can then be placed
528  * in the new tuple constructed by INSERT or UPDATE.
529  */
530  if (indirection)
531  {
532  Node *colVar;
533 
534  if (pstate->p_is_insert)
535  {
536  /*
537  * The command is INSERT INTO table (col.something) ... so there
538  * is not really a source value to work with. Insert a NULL
539  * constant as the source value.
540  */
541  colVar = (Node *) makeNullConst(attrtype, attrtypmod,
542  attrcollation);
543  }
544  else
545  {
546  /*
547  * Build a Var for the column to be updated.
548  */
549  Var *var;
550 
551  var = makeVar(pstate->p_target_nsitem->p_rtindex, attrno,
552  attrtype, attrtypmod, attrcollation, 0);
553  var->location = location;
554 
555  colVar = (Node *) var;
556  }
557 
558  expr = (Expr *)
560  colVar,
561  colname,
562  false,
563  attrtype,
564  attrtypmod,
565  attrcollation,
566  indirection,
567  list_head(indirection),
568  (Node *) expr,
570  location);
571  }
572  else
573  {
574  /*
575  * For normal non-qualified target column, do type checking and
576  * coercion.
577  */
578  Node *orig_expr = (Node *) expr;
579 
580  expr = (Expr *)
581  coerce_to_target_type(pstate,
582  orig_expr, type_id,
583  attrtype, attrtypmod,
586  -1);
587  if (expr == NULL)
588  ereport(ERROR,
589  (errcode(ERRCODE_DATATYPE_MISMATCH),
590  errmsg("column \"%s\" is of type %s"
591  " but expression is of type %s",
592  colname,
593  format_type_be(attrtype),
594  format_type_be(type_id)),
595  errhint("You will need to rewrite or cast the expression."),
596  parser_errposition(pstate, exprLocation(orig_expr))));
597  }
598 
599  pstate->p_expr_kind = sv_expr_kind;
600 
601  return expr;
602 }
#define IsA(nodeptr, _type_)
Definition: nodes.h:584
int errhint(const char *fmt,...)
Definition: elog.c:1162
int exprLocation(const Node *expr)
Definition: nodeFuncs.c:1231
#define TupleDescAttr(tupdesc, i)
Definition: tupdesc.h:92
Definition: nodes.h:533
int errcode(int sqlerrcode)
Definition: elog.c:704
char * format_type_be(Oid type_oid)
Definition: format_type.c:339
ParseNamespaceItem * p_target_nsitem
Definition: parse_node.h:192
unsigned int Oid
Definition: postgres_ext.h:31
Definition: primnodes.h:181
ParseExprKind
Definition: parse_node.h:38
signed int int32
Definition: c.h:429
Const * makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid)
Definition: makefuncs.c:337
#define linitial(l)
Definition: pg_list.h:174
#define ERROR
Definition: elog.h:45
Node * coerce_to_target_type(ParseState *pstate, Node *expr, Oid exprtype, Oid targettype, int32 targettypmod, CoercionContext ccontext, CoercionForm cformat, int location)
Definition: parse_coerce.c:78
int location
Definition: primnodes.h:196
int32 typeMod
Definition: primnodes.h:1320
Oid attnumTypeId(Relation rd, int attid)
static ListCell * list_head(const List *l)
Definition: pg_list.h:125
Var * makeVar(Index varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
Definition: makefuncs.c:66
ParseExprKind p_expr_kind
Definition: parse_node.h:195
TupleDesc rd_att
Definition: rel.h:111
#define ereport(elevel,...)
Definition: elog.h:155
#define Assert(condition)
Definition: c.h:804
Oid exprType(const Node *expr)
Definition: nodeFuncs.c:41
int parser_errposition(ParseState *pstate, int location)
Definition: parse_node.c:111
int errmsg(const char *fmt,...)
Definition: elog.c:915
Relation p_target_relation
Definition: parse_node.h:191
bool p_is_insert
Definition: parse_node.h:193
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)
Definition: parse_target.c:686

◆ transformAssignmentIndirection()

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 
)

Definition at line 686 of file parse_target.c.

References FieldStore::arg, Assert, attnum, COERCE_IMPLICIT_CAST, coerce_to_domain(), coerce_to_target_type(), COERCION_IMPLICIT, CaseTestExpr::collation, ereport, errcode(), errhint(), errmsg(), ERROR, exprType(), FieldStore::fieldnums, for_each_cell, format_type_be(), get_attnum(), get_atttypetypmodcoll(), getBaseTypeAndTypmod(), i, InvalidAttrNumber, IsA, lappend(), lfirst, list_make1, list_make1_int, lnext(), makeNode, FieldStore::newvals, NIL, parser_errposition(), FieldStore::resulttype, strVal, transformAssignmentIndirection(), transformAssignmentSubscripts(), CaseTestExpr::typeId, typeidTypeRelid(), and CaseTestExpr::typeMod.

Referenced by transformAssignedExpr(), transformAssignmentIndirection(), transformAssignmentSubscripts(), and transformPLAssignStmt().

698 {
699  Node *result;
700  List *subscripts = NIL;
701  bool isSlice = false;
702  ListCell *i;
703 
704  if (indirection_cell && !basenode)
705  {
706  /*
707  * Set up a substitution. We abuse CaseTestExpr for this. It's safe
708  * to do so because the only nodes that will be above the CaseTestExpr
709  * in the finished expression will be FieldStore and SubscriptingRef
710  * nodes. (There could be other stuff in the tree, but it will be
711  * within other child fields of those node types.)
712  */
714 
715  ctest->typeId = targetTypeId;
716  ctest->typeMod = targetTypMod;
717  ctest->collation = targetCollation;
718  basenode = (Node *) ctest;
719  }
720 
721  /*
722  * We have to split any field-selection operations apart from
723  * subscripting. Adjacent A_Indices nodes have to be treated as a single
724  * multidimensional subscript operation.
725  */
726  for_each_cell(i, indirection, indirection_cell)
727  {
728  Node *n = lfirst(i);
729 
730  if (IsA(n, A_Indices))
731  {
732  subscripts = lappend(subscripts, n);
733  if (((A_Indices *) n)->is_slice)
734  isSlice = true;
735  }
736  else if (IsA(n, A_Star))
737  {
738  ereport(ERROR,
739  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
740  errmsg("row expansion via \"*\" is not supported here"),
741  parser_errposition(pstate, location)));
742  }
743  else
744  {
745  FieldStore *fstore;
746  Oid baseTypeId;
747  int32 baseTypeMod;
748  Oid typrelid;
750  Oid fieldTypeId;
751  int32 fieldTypMod;
752  Oid fieldCollation;
753 
754  Assert(IsA(n, String));
755 
756  /* process subscripts before this field selection */
757  if (subscripts)
758  {
759  /* recurse, and then return because we're done */
760  return transformAssignmentSubscripts(pstate,
761  basenode,
762  targetName,
763  targetTypeId,
764  targetTypMod,
765  targetCollation,
766  subscripts,
767  isSlice,
768  indirection,
769  i,
770  rhs,
771  ccontext,
772  location);
773  }
774 
775  /* No subscripts, so can process field selection here */
776 
777  /*
778  * Look up the composite type, accounting for possibility that
779  * what we are given is a domain over composite.
780  */
781  baseTypeMod = targetTypMod;
782  baseTypeId = getBaseTypeAndTypmod(targetTypeId, &baseTypeMod);
783 
784  typrelid = typeidTypeRelid(baseTypeId);
785  if (!typrelid)
786  ereport(ERROR,
787  (errcode(ERRCODE_DATATYPE_MISMATCH),
788  errmsg("cannot assign to field \"%s\" of column \"%s\" because its type %s is not a composite type",
789  strVal(n), targetName,
790  format_type_be(targetTypeId)),
791  parser_errposition(pstate, location)));
792 
793  attnum = get_attnum(typrelid, strVal(n));
794  if (attnum == InvalidAttrNumber)
795  ereport(ERROR,
796  (errcode(ERRCODE_UNDEFINED_COLUMN),
797  errmsg("cannot assign to field \"%s\" of column \"%s\" because there is no such column in data type %s",
798  strVal(n), targetName,
799  format_type_be(targetTypeId)),
800  parser_errposition(pstate, location)));
801  if (attnum < 0)
802  ereport(ERROR,
803  (errcode(ERRCODE_UNDEFINED_COLUMN),
804  errmsg("cannot assign to system column \"%s\"",
805  strVal(n)),
806  parser_errposition(pstate, location)));
807 
808  get_atttypetypmodcoll(typrelid, attnum,
809  &fieldTypeId, &fieldTypMod, &fieldCollation);
810 
811  /* recurse to create appropriate RHS for field assign */
812  rhs = transformAssignmentIndirection(pstate,
813  NULL,
814  strVal(n),
815  false,
816  fieldTypeId,
817  fieldTypMod,
818  fieldCollation,
819  indirection,
820  lnext(indirection, i),
821  rhs,
822  ccontext,
823  location);
824 
825  /* and build a FieldStore node */
826  fstore = makeNode(FieldStore);
827  fstore->arg = (Expr *) basenode;
828  fstore->newvals = list_make1(rhs);
829  fstore->fieldnums = list_make1_int(attnum);
830  fstore->resulttype = baseTypeId;
831 
832  /* If target is a domain, apply constraints */
833  if (baseTypeId != targetTypeId)
834  return coerce_to_domain((Node *) fstore,
835  baseTypeId, baseTypeMod,
836  targetTypeId,
839  location,
840  false);
841 
842  return (Node *) fstore;
843  }
844  }
845 
846  /* process trailing subscripts, if any */
847  if (subscripts)
848  {
849  /* recurse, and then return because we're done */
850  return transformAssignmentSubscripts(pstate,
851  basenode,
852  targetName,
853  targetTypeId,
854  targetTypMod,
855  targetCollation,
856  subscripts,
857  isSlice,
858  indirection,
859  NULL,
860  rhs,
861  ccontext,
862  location);
863  }
864 
865  /* base case: just coerce RHS to match target type ID */
866 
867  result = coerce_to_target_type(pstate,
868  rhs, exprType(rhs),
869  targetTypeId, targetTypMod,
870  ccontext,
872  -1);
873  if (result == NULL)
874  {
875  if (targetIsSubscripting)
876  ereport(ERROR,
877  (errcode(ERRCODE_DATATYPE_MISMATCH),
878  errmsg("subscripted assignment to \"%s\" requires type %s"
879  " but expression is of type %s",
880  targetName,
881  format_type_be(targetTypeId),
882  format_type_be(exprType(rhs))),
883  errhint("You will need to rewrite or cast the expression."),
884  parser_errposition(pstate, location)));
885  else
886  ereport(ERROR,
887  (errcode(ERRCODE_DATATYPE_MISMATCH),
888  errmsg("subfield \"%s\" is of type %s"
889  " but expression is of type %s",
890  targetName,
891  format_type_be(targetTypeId),
892  format_type_be(exprType(rhs))),
893  errhint("You will need to rewrite or cast the expression."),
894  parser_errposition(pstate, location)));
895  }
896 
897  return result;
898 }
#define NIL
Definition: pg_list.h:65
Oid getBaseTypeAndTypmod(Oid typid, int32 *typmod)
Definition: lsyscache.c:2485
#define IsA(nodeptr, _type_)
Definition: nodes.h:584
Expr * arg
Definition: primnodes.h:815
int errhint(const char *fmt,...)
Definition: elog.c:1162
static ListCell * lnext(const List *l, const ListCell *c)
Definition: pg_list.h:322
#define for_each_cell(cell, lst, initcell)
Definition: pg_list.h:417
Definition: nodes.h:533
#define strVal(v)
Definition: value.h:54
int errcode(int sqlerrcode)
Definition: elog.c:704
char * format_type_be(Oid type_oid)
Definition: format_type.c:339
Oid typeidTypeRelid(Oid type_id)
Definition: parse_type.c:666
unsigned int Oid
Definition: postgres_ext.h:31
int32 typeMod
Definition: primnodes.h:997
signed int int32
Definition: c.h:429
#define list_make1(x1)
Definition: pg_list.h:206
#define ERROR
Definition: elog.h:45
Node * coerce_to_target_type(ParseState *pstate, Node *expr, Oid exprtype, Oid targettype, int32 targettypmod, CoercionContext ccontext, CoercionForm cformat, int location)
Definition: parse_coerce.c:78
Node * coerce_to_domain(Node *arg, Oid baseTypeId, int32 baseTypeMod, Oid typeId, CoercionContext ccontext, CoercionForm cformat, int location, bool hideInputCoercion)
Definition: parse_coerce.c:669
AttrNumber get_attnum(Oid relid, const char *attname)
Definition: lsyscache.c:856
static Node * transformAssignmentSubscripts(ParseState *pstate, Node *basenode, const char *targetName, Oid targetTypeId, int32 targetTypMod, Oid targetCollation, List *subscripts, bool isSlice, List *indirection, ListCell *next_indirection, Node *rhs, CoercionContext ccontext, int location)
Definition: parse_target.c:904
Oid resulttype
Definition: primnodes.h:818
#define list_make1_int(x1)
Definition: pg_list.h:221
List * newvals
Definition: primnodes.h:816
List * lappend(List *list, void *datum)
Definition: list.c:336
int16 attnum
Definition: pg_attribute.h:83
#define ereport(elevel,...)
Definition: elog.h:155
#define makeNode(_type_)
Definition: nodes.h:581
#define Assert(condition)
Definition: c.h:804
#define lfirst(lc)
Definition: pg_list.h:169
void get_atttypetypmodcoll(Oid relid, AttrNumber attnum, Oid *typid, int32 *typmod, Oid *collid)
Definition: lsyscache.c:968
Oid exprType(const Node *expr)
Definition: nodeFuncs.c:41
int parser_errposition(ParseState *pstate, int location)
Definition: parse_node.c:111
#define InvalidAttrNumber
Definition: attnum.h:23
int errmsg(const char *fmt,...)
Definition: elog.c:915
List * fieldnums
Definition: primnodes.h:817
int i
Definition: pg_list.h:50
int16 AttrNumber
Definition: attnum.h:21
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)
Definition: parse_target.c:686

◆ transformExpressionList()

List* transformExpressionList ( ParseState pstate,
List exprlist,
ParseExprKind  exprKind,
bool  allowDefault 
)

Definition at line 220 of file parse_target.c.

References Assert, ExpandColumnRefStar(), ExpandIndirectionStar(), ColumnRef::fields, A_Indirection::indirection, IsA, lappend(), lfirst, list_concat(), llast, NIL, ParseState::p_multiassign_exprs, and transformExpr().

Referenced by transformInsertStmt(), transformRowExpr(), and transformValuesClause().

222 {
223  List *result = NIL;
224  ListCell *lc;
225 
226  foreach(lc, exprlist)
227  {
228  Node *e = (Node *) lfirst(lc);
229 
230  /*
231  * Check for "something.*". Depending on the complexity of the
232  * "something", the star could appear as the last field in ColumnRef,
233  * or as the last indirection item in A_Indirection.
234  */
235  if (IsA(e, ColumnRef))
236  {
237  ColumnRef *cref = (ColumnRef *) e;
238 
239  if (IsA(llast(cref->fields), A_Star))
240  {
241  /* It is something.*, expand into multiple items */
242  result = list_concat(result,
243  ExpandColumnRefStar(pstate, cref,
244  false));
245  continue;
246  }
247  }
248  else if (IsA(e, A_Indirection))
249  {
251 
252  if (IsA(llast(ind->indirection), A_Star))
253  {
254  /* It is something.*, expand into multiple items */
255  result = list_concat(result,
256  ExpandIndirectionStar(pstate, ind,
257  false, exprKind));
258  continue;
259  }
260  }
261 
262  /*
263  * Not "something.*", so transform as a single expression. If it's a
264  * SetToDefault node and we should allow that, pass it through
265  * unmodified. (transformExpr will throw the appropriate error if
266  * we're disallowing it.)
267  */
268  if (allowDefault && IsA(e, SetToDefault))
269  /* do nothing */ ;
270  else
271  e = transformExpr(pstate, e, exprKind);
272 
273  result = lappend(result, e);
274  }
275 
276  /* Shouldn't have any multiassign items here */
277  Assert(pstate->p_multiassign_exprs == NIL);
278 
279  return result;
280 }
#define NIL
Definition: pg_list.h:65
#define IsA(nodeptr, _type_)
Definition: nodes.h:584
Node * transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind)
Definition: parse_expr.c:94
#define llast(l)
Definition: pg_list.h:194
Definition: nodes.h:533
List * list_concat(List *list1, const List *list2)
Definition: list.c:530
List * p_multiassign_exprs
Definition: parse_node.h:197
static List * ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref, bool make_target_entry)
struct A_Star A_Star
static List * ExpandIndirectionStar(ParseState *pstate, A_Indirection *ind, bool make_target_entry, ParseExprKind exprKind)
List * lappend(List *list, void *datum)
Definition: list.c:336
#define Assert(condition)
Definition: c.h:804
#define lfirst(lc)
Definition: pg_list.h:169
List * indirection
Definition: parsenodes.h:407
e
Definition: preproc-init.c:82
Definition: pg_list.h:50
List * fields
Definition: parsenodes.h:236

◆ transformTargetEntry()

TargetEntry* transformTargetEntry ( ParseState pstate,
Node node,
Node expr,
ParseExprKind  exprKind,
char *  colname,
bool  resjunk 
)

Definition at line 77 of file parse_target.c.

References EXPR_KIND_UPDATE_SOURCE, FigureColname(), IsA, makeTargetEntry(), ParseState::p_next_resno, and transformExpr().

Referenced by findTargetlistEntrySQL99(), and transformTargetList().

83 {
84  /* Transform the node if caller didn't do it already */
85  if (expr == NULL)
86  {
87  /*
88  * If it's a SetToDefault node and we should allow that, pass it
89  * through unmodified. (transformExpr will throw the appropriate
90  * error if we're disallowing it.)
91  */
92  if (exprKind == EXPR_KIND_UPDATE_SOURCE && IsA(node, SetToDefault))
93  expr = node;
94  else
95  expr = transformExpr(pstate, node, exprKind);
96  }
97 
98  if (colname == NULL && !resjunk)
99  {
100  /*
101  * Generate a suitable column name for a column without any explicit
102  * 'AS ColumnName' clause.
103  */
104  colname = FigureColname(node);
105  }
106 
107  return makeTargetEntry((Expr *) expr,
108  (AttrNumber) pstate->p_next_resno++,
109  colname,
110  resjunk);
111 }
#define IsA(nodeptr, _type_)
Definition: nodes.h:584
Node * transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind)
Definition: parse_expr.c:94
char * FigureColname(Node *node)
int p_next_resno
Definition: parse_node.h:196
TargetEntry * makeTargetEntry(Expr *expr, AttrNumber resno, char *resname, bool resjunk)
Definition: makefuncs.c:238
int16 AttrNumber
Definition: attnum.h:21

◆ transformTargetList()

List* transformTargetList ( ParseState pstate,
List targetlist,
ParseExprKind  exprKind 
)

Definition at line 123 of file parse_target.c.

References Assert, ExpandColumnRefStar(), ExpandIndirectionStar(), EXPR_KIND_UPDATE_SOURCE, ColumnRef::fields, A_Indirection::indirection, IsA, lappend(), lfirst, list_concat(), llast, ResTarget::name, NIL, ParseState::p_multiassign_exprs, transformTargetEntry(), and ResTarget::val.

Referenced by transformPLAssignStmt(), transformReturningList(), transformSelectStmt(), and transformUpdateTargetList().

125 {
126  List *p_target = NIL;
127  bool expand_star;
128  ListCell *o_target;
129 
130  /* Shouldn't have any leftover multiassign items at start */
131  Assert(pstate->p_multiassign_exprs == NIL);
132 
133  /* Expand "something.*" in SELECT and RETURNING, but not UPDATE */
134  expand_star = (exprKind != EXPR_KIND_UPDATE_SOURCE);
135 
136  foreach(o_target, targetlist)
137  {
138  ResTarget *res = (ResTarget *) lfirst(o_target);
139 
140  /*
141  * Check for "something.*". Depending on the complexity of the
142  * "something", the star could appear as the last field in ColumnRef,
143  * or as the last indirection item in A_Indirection.
144  */
145  if (expand_star)
146  {
147  if (IsA(res->val, ColumnRef))
148  {
149  ColumnRef *cref = (ColumnRef *) res->val;
150 
151  if (IsA(llast(cref->fields), A_Star))
152  {
153  /* It is something.*, expand into multiple items */
154  p_target = list_concat(p_target,
155  ExpandColumnRefStar(pstate,
156  cref,
157  true));
158  continue;
159  }
160  }
161  else if (IsA(res->val, A_Indirection))
162  {
163  A_Indirection *ind = (A_Indirection *) res->val;
164 
165  if (IsA(llast(ind->indirection), A_Star))
166  {
167  /* It is something.*, expand into multiple items */
168  p_target = list_concat(p_target,
169  ExpandIndirectionStar(pstate,
170  ind,
171  true,
172  exprKind));
173  continue;
174  }
175  }
176  }
177 
178  /*
179  * Not "something.*", or we want to treat that as a plain whole-row
180  * variable, so transform as a single expression
181  */
182  p_target = lappend(p_target,
183  transformTargetEntry(pstate,
184  res->val,
185  NULL,
186  exprKind,
187  res->name,
188  false));
189  }
190 
191  /*
192  * If any multiassign resjunk items were created, attach them to the end
193  * of the targetlist. This should only happen in an UPDATE tlist. We
194  * don't need to worry about numbering of these items; transformUpdateStmt
195  * will set their resnos.
196  */
197  if (pstate->p_multiassign_exprs)
198  {
199  Assert(exprKind == EXPR_KIND_UPDATE_SOURCE);
200  p_target = list_concat(p_target, pstate->p_multiassign_exprs);
201  pstate->p_multiassign_exprs = NIL;
202  }
203 
204  return p_target;
205 }
#define NIL
Definition: pg_list.h:65
#define IsA(nodeptr, _type_)
Definition: nodes.h:584
Node * val
Definition: parsenodes.h:443
char * name
Definition: parsenodes.h:441
#define llast(l)
Definition: pg_list.h:194
List * list_concat(List *list1, const List *list2)
Definition: list.c:530
List * p_multiassign_exprs
Definition: parse_node.h:197
static List * ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref, bool make_target_entry)
struct A_Star A_Star
static List * ExpandIndirectionStar(ParseState *pstate, A_Indirection *ind, bool make_target_entry, ParseExprKind exprKind)
List * lappend(List *list, void *datum)
Definition: list.c:336
#define Assert(condition)
Definition: c.h:804
#define lfirst(lc)
Definition: pg_list.h:169
List * indirection
Definition: parsenodes.h:407
TargetEntry * transformTargetEntry(ParseState *pstate, Node *node, Node *expr, ParseExprKind exprKind, char *colname, bool resjunk)
Definition: parse_target.c:77
Definition: pg_list.h:50
List * fields
Definition: parsenodes.h:236

◆ updateTargetListEntry()

void updateTargetListEntry ( ParseState pstate,
TargetEntry tle,
char *  colname,
int  attrno,
List indirection,
int  location 
)

Definition at line 622 of file parse_target.c.

References TargetEntry::expr, EXPR_KIND_UPDATE_TARGET, TargetEntry::resname, TargetEntry::resno, and transformAssignedExpr().

Referenced by transformUpdateTargetList().

628 {
629  /* Fix up expression as needed */
630  tle->expr = transformAssignedExpr(pstate,
631  tle->expr,
633  colname,
634  attrno,
635  indirection,
636  location);
637 
638  /*
639  * Set the resno to identify the target column --- the rewriter and
640  * planner depend on this. We also set the resname to identify the target
641  * column, but this is only for debugging purposes; it should not be
642  * relied on. (In particular, it might be out of date in a stored rule.)
643  */
644  tle->resno = (AttrNumber) attrno;
645  tle->resname = colname;
646 }
Expr * transformAssignedExpr(ParseState *pstate, Expr *expr, ParseExprKind exprKind, const char *colname, int attrno, List *indirection, int location)
Definition: parse_target.c:455
char * resname
Definition: primnodes.h:1433
AttrNumber resno
Definition: primnodes.h:1432
Expr * expr
Definition: primnodes.h:1431
int16 AttrNumber
Definition: attnum.h:21