67 int result_relation =
parse->resultRelation;
82 target_rte =
rt_fetch(result_relation, range_table);
89 elog(
ERROR,
"result relation must be a regular relation");
105 tlist =
parse->targetList;
124 root->processed_tlist = tlist;
126 target_rte, target_relation);
127 tlist =
root->processed_tlist;
147 foreach(l,
parse->mergeActionList)
175 if (
IsA(var,
Var) && var->
varno == result_relation)
201 if (
IsA(var,
Var) && var->
varno == result_relation)
229 foreach(lc,
root->rowMarks)
311 var->
varno == result_relation)
327 root->processed_tlist = tlist;
360 tle->
resno = nextresno++;
362 return update_colnos;
400 for (attrno = 1; attrno <= numattrs; attrno++)
405 if (tlist_item != NULL)
409 if (!old_tle->resjunk && old_tle->
resno == attrno)
412 tlist_item =
lnext(tlist, tlist_item);
444 if (att_tup->attisdropped)
455 else if (att_tup->attgenerated)
458 Oid baseTypeId = att_tup->atttypid;
459 int32 baseTypeMod = att_tup->atttypmod;
464 att_tup->attcollation,
475 att_tup->attcollation,
489 new_tlist =
lappend(new_tlist, new_tle);
503 if (!old_tle->resjunk)
504 elog(
ERROR,
"targetlist is not sorted correctly");
506 if (old_tle->
resno != attrno)
509 old_tle->
resno = attrno;
511 new_tlist =
lappend(new_tlist, old_tle);
513 tlist_item =
lnext(tlist, tlist_item);
534 if (rc->
rti == rtindex)
void add_row_identity_columns(PlannerInfo *root, Index rtindex, RangeTblEntry *target_rte, Relation target_relation)
Node * eval_const_expressions(PlannerInfo *root, Node *node)
Assert(PointerIsAligned(start, uint64))
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)
Oid getBaseTypeAndTypmod(Oid typid, int32 *typmod)
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)