65 int result_relation =
parse->resultRelation;
80 target_rte =
rt_fetch(result_relation, range_table);
87 elog(
ERROR,
"result relation must be a regular relation");
103 tlist =
parse->targetList;
122 root->processed_tlist = tlist;
124 target_rte, target_relation);
125 tlist =
root->processed_tlist;
145 foreach(l,
parse->mergeActionList)
172 if (
IsA(var,
Var) && var->
varno == result_relation)
198 if (
IsA(var,
Var) && var->
varno == result_relation)
226 foreach(lc,
root->rowMarks)
308 var->
varno == result_relation)
324 root->processed_tlist = tlist;
357 tle->
resno = nextresno++;
359 return update_colnos;
397 for (attrno = 1; attrno <= numattrs; attrno++)
402 if (tlist_item != NULL)
406 if (!old_tle->resjunk && old_tle->
resno == attrno)
409 tlist_item =
lnext(tlist, tlist_item);
433 Oid atttype = att_tup->atttypid;
434 Oid attcollation = att_tup->attcollation;
437 if (!att_tup->attisdropped)
472 new_tlist =
lappend(new_tlist, new_tle);
486 if (!old_tle->resjunk)
487 elog(
ERROR,
"targetlist is not sorted correctly");
489 if (old_tle->
resno != attrno)
492 old_tle->
resno = attrno;
494 new_tlist =
lappend(new_tlist, old_tle);
496 tlist_item =
lnext(tlist, tlist_item);
517 if (rc->
rti == rtindex)
void add_row_identity_columns(PlannerInfo *root, Index rtindex, RangeTblEntry *target_rte, Relation target_relation)
#define Assert(condition)
List * lappend(List *list, void *datum)
List * lappend_int(List *list, int datum)
void list_free(List *list)
List * list_concat_copy(const List *list1, const List *list2)
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)
Var * makeVar(int varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
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_to_domain(Node *arg, Oid baseTypeId, int32 baseTypeMod, Oid typeId, CoercionContext ccontext, CoercionForm cformat, int location, bool hideInputCoercion)
#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)
PlanRowMark * get_plan_rowmark(List *rowmarks, Index rtindex)
void preprocess_targetlist(PlannerInfo *root)
static List * expand_insert_targetlist(List *tlist, Relation rel)
List * extract_update_targetlist_colnos(List *tlist)
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)
#define TupleDescAttr(tupdesc, i)
List * pull_var_clause(Node *node, int flags)