109 if (
att->attisdropped)
117 atttypmod =
att->atttypmod;
118 attcollation =
att->attcollation;
153 elog(
ERROR,
"could not find inherited attribute \"%s\" of relation \"%s\"",
166 errmsg(
"attribute \"%s\" of relation \"%s\" does not match parent's type",
168 if (attcollation !=
att->attcollation)
171 errmsg(
"attribute \"%s\" of relation \"%s\" does not match parent's collation",
267 for (cnt = 0; cnt < nappinfos; cnt++)
281 var->varattnosyn = 0;
287 elog(
ERROR,
"attribute %d of relation \"%s\" does not exist",
292 elog(
ERROR,
"attribute %d of relation \"%s\" does not exist",
300 var->varnullingrels);
305 elog(
ERROR,
"failed to apply returningtype to a non-Var");
306 if (var->varnullingrels !=
NULL)
307 elog(
ERROR,
"failed to apply nullingrels to a non-Var");
331 var->vartype =
appinfo->child_reltype;
356 rowexpr->
args = fields;
357 rowexpr->row_typeid = var->vartype;
363 elog(
ERROR,
"failed to apply returningtype to a non-Var");
364 if (var->varnullingrels !=
NULL)
365 elog(
ERROR,
"failed to apply nullingrels to a non-Var");
367 return (
Node *) rowexpr;
385 for (cnt = 0; cnt < nappinfos; cnt++)
391 elog(
ERROR,
"cannot translate to multiple leaf relids");
411 var->varattnosyn = 0;
431 for (cnt = 0; cnt < nappinfos; cnt++)
441 return (
Node *) cexpr;
452 if (
phv->phlevelsup == 0)
455 nappinfos, appinfos);
510 newinfo->eval_cost.startup = -1;
517 newinfo->right_bucketsize = -1;
612 elog(
ERROR,
"childrel is not a child of parentrel");
635 for (cnt = 0; cnt < nappinfos; cnt++)
686 elog(
ERROR,
"childrel is not a child of parentrel");
721 elog(
ERROR,
"attribute %d of relation \"%s\" does not exist",
725 elog(
ERROR,
"attribute %d of relation \"%s\" does not exist",
744 elog(
ERROR,
"child rel %d not found in append_rel_array", child_relid);
767 List **processed_tlist,
List **update_colnos)
771 if (relid ==
root->parse->resultRelation)
784 *processed_tlist = (
List *)
793 root->parse->resultRelation);
829 elog(
ERROR,
"child rel %d not found in append_rel_array",
i);
883 if (rtindex ==
root->parse->resultRelation)
910 foreach(
lc,
root->row_identity_vars)
924 elog(
ERROR,
"conflicting uses of row-identity name \"%s\"",
1043 int result_relation =
parse->resultRelation;
1058 if (!target_rte->
inh)
1077 if (
root->row_identity_vars ==
NIL)
1099 foreach(
lc,
root->processed_tlist)
void distribute_row_identity_vars(PlannerInfo *root)
void get_translated_update_targetlist(PlannerInfo *root, Index relid, List **processed_tlist, List **update_colnos)
AppendRelInfo ** find_appinfos_by_relids(PlannerInfo *root, Relids relids, int *nappinfos)
static void make_inh_translation_list(Relation oldrelation, Relation newrelation, Index newvarno, AppendRelInfo *appinfo)
Node * adjust_appendrel_attrs(PlannerInfo *root, Node *node, int nappinfos, AppendRelInfo **appinfos)
Relids adjust_child_relids_multilevel(PlannerInfo *root, Relids relids, RelOptInfo *childrel, RelOptInfo *parentrel)
List * adjust_inherited_attnums_multilevel(PlannerInfo *root, List *attnums, Index child_relid, Index top_parent_relid)
Node * adjust_appendrel_attrs_multilevel(PlannerInfo *root, Node *node, RelOptInfo *childrel, RelOptInfo *parentrel)
void add_row_identity_columns(PlannerInfo *root, Index rtindex, RangeTblEntry *target_rte, Relation target_relation)
static Node * adjust_appendrel_attrs_mutator(Node *node, adjust_appendrel_attrs_context *context)
AppendRelInfo * make_append_rel_info(Relation parentrel, Relation childrel, Index parentRTindex, Index childRTindex)
Relids adjust_child_relids(Relids relids, int nappinfos, AppendRelInfo **appinfos)
void add_row_identity_var(PlannerInfo *root, Var *orig_var, Index rtindex, const char *rowid_name)
List * adjust_inherited_attnums(List *attnums, AppendRelInfo *context)
#define InvalidAttrNumber
Bitmapset * bms_make_singleton(int x)
int bms_next_member(const Bitmapset *a, int prevbit)
Bitmapset * bms_del_member(Bitmapset *a, int x)
int bms_num_members(const Bitmapset *a)
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_add_member(Bitmapset *a, int x)
Bitmapset * bms_add_members(Bitmapset *a, const Bitmapset *b)
bool bms_overlap(const Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_copy(const Bitmapset *a)
#define Assert(condition)
#define OidIsValid(objectId)
int errcode(int sqlerrcode)
#define ereport(elevel,...)
bool equal(const void *a, const void *b)
#define palloc_array(type, count)
FdwRoutine * GetFdwRoutineForRelation(Relation relation, bool makecopy)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void build_base_rel_tlists(PlannerInfo *root, List *final_tlist)
List * lappend(List *list, void *datum)
List * lappend_int(List *list, int datum)
char * get_rel_name(Oid relid)
int32 get_typavgwidth(Oid typid, int32 typmod)
Var * makeVar(int varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
Const * makeNullConst(Oid consttype, int32 consttypmod, Oid constcollid)
TargetEntry * makeTargetEntry(Expr *expr, AttrNumber resno, char *resname, bool resjunk)
char * pstrdup(const char *in)
void pfree(void *pointer)
void * palloc0(Size size)
Oid exprType(const Node *expr)
int32 exprTypmod(const Node *expr)
#define expression_tree_mutator(n, m, c)
#define IsA(nodeptr, _type_)
#define rt_fetch(rangetable_index, rangetable)
FormData_pg_attribute * Form_pg_attribute
static int list_length(const List *l)
static void * list_nth(const List *list, int n)
#define RelationGetRelid(relation)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
RelOptInfo * find_base_rel(PlannerInfo *root, int relid)
RelOptInfo * find_base_rel_ignore_join(PlannerInfo *root, int relid)
AddForeignUpdateTargets_function AddForeignUpdateTargets
Relids leaf_result_relids
VarReturningType varreturningtype
AppendRelInfo ** appinfos
#define SelfItemPointerAttributeNumber
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCacheAttName(Oid relid, const char *attname)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)