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;
124 target_rte, target_relation);
144 foreach(l,
parse->mergeActionList)
172 if (
IsA(var,
Var) && var->
varno == result_relation)
284 var->
varno == result_relation)
333 tle->
resno = nextresno++;
335 return update_colnos;
373 for (attrno = 1; attrno <= numattrs; attrno++)
378 if (tlist_item != NULL)
382 if (!old_tle->resjunk && old_tle->
resno == attrno)
385 tlist_item =
lnext(tlist, tlist_item);
409 Oid atttype = att_tup->atttypid;
410 Oid attcollation = att_tup->attcollation;
413 if (!att_tup->attisdropped)
448 new_tlist =
lappend(new_tlist, new_tle);
462 if (!old_tle->resjunk)
463 elog(
ERROR,
"targetlist is not sorted correctly");
465 if (old_tle->
resno != attrno)
468 old_tle->
resno = attrno;
470 new_tlist =
lappend(new_tlist, old_tle);
472 tlist_item =
lnext(tlist, tlist_item);
493 if (rc->
rti == rtindex)
void add_row_identity_columns(PlannerInfo *root, Index rtindex, RangeTblEntry *target_rte, Relation target_relation)
elog(ERROR, "%s: %s", p2, msg)
Assert(fmt[strlen(fmt) - 1] !='\n')
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)