66 int result_relation =
parse->resultRelation;
81 target_rte =
rt_fetch(result_relation, range_table);
88 elog(
ERROR,
"result relation must be a regular relation");
104 tlist =
parse->targetList;
123 root->processed_tlist = tlist;
125 target_rte, target_relation);
126 tlist =
root->processed_tlist;
146 foreach(l,
parse->mergeActionList)
174 if (
IsA(var,
Var) && var->
varno == result_relation)
200 if (
IsA(var,
Var) && var->
varno == result_relation)
228 foreach(lc,
root->rowMarks)
310 var->
varno == result_relation)
326 root->processed_tlist = tlist;
359 tle->
resno = nextresno++;
361 return update_colnos;
399 for (attrno = 1; attrno <= numattrs; attrno++)
404 if (tlist_item != NULL)
408 if (!old_tle->resjunk && old_tle->
resno == attrno)
411 tlist_item =
lnext(tlist, tlist_item);
437 if (!att_tup->attisdropped)
441 att_tup->attcollation,
466 new_tlist =
lappend(new_tlist, new_tle);
480 if (!old_tle->resjunk)
481 elog(
ERROR,
"targetlist is not sorted correctly");
483 if (old_tle->
resno != attrno)
486 old_tle->
resno = attrno;
488 new_tlist =
lappend(new_tlist, old_tle);
490 tlist_item =
lnext(tlist, tlist_item);
511 if (rc->
rti == rtindex)
void add_row_identity_columns(PlannerInfo *root, Index rtindex, RangeTblEntry *target_rte, Relation target_relation)
#define Assert(condition)
Node * eval_const_expressions(PlannerInfo *root, Node *node)
List * lappend(List *list, void *datum)
List * list_concat_copy(const List *list1, const List *list2)
List * lappend_int(List *list, int datum)
void list_free(List *list)
Var * makeVar(int varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
Var * makeWholeRowVar(RangeTblEntry *rte, int varno, Index varlevelsup, bool allowScalar)
TargetEntry * makeTargetEntry(Expr *expr, AttrNumber resno, char *resname, bool resjunk)
Const * makeConst(Oid consttype, int32 consttypmod, Oid constcollid, int constlen, Datum constvalue, bool constisnull, bool constbyval)
TargetEntry * flatCopyTargetEntry(TargetEntry *src_tle)
char * pstrdup(const char *in)
#define IsA(nodeptr, _type_)
#define PVC_RECURSE_AGGREGATES
#define PVC_RECURSE_WINDOWFUNCS
#define PVC_INCLUDE_PLACEHOLDERS
Node * coerce_null_to_domain(Oid typid, int32 typmod, Oid collation, int typlen, bool typbyval)
#define rt_fetch(rangetable_index, rangetable)
FormData_pg_attribute * Form_pg_attribute
static int list_length(const List *l)
static ListCell * list_head(const List *l)
static ListCell * lnext(const List *l, const ListCell *c)
List * extract_update_targetlist_colnos(List *tlist)
void preprocess_targetlist(PlannerInfo *root)
PlanRowMark * get_plan_rowmark(List *rowmarks, Index rtindex)
static List * expand_insert_targetlist(PlannerInfo *root, List *tlist, Relation rel)
static struct subre * parse(struct vars *v, int stopper, int type, struct state *init, struct state *final)
#define RelationGetNumberOfAttributes(relation)
#define TableOidAttributeNumber
#define SelfItemPointerAttributeNumber
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
TargetEntry * tlist_member(Expr *node, List *targetlist)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
List * pull_var_clause(Node *node, int flags)