PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/htup_details.h"
#include "access/table.h"
#include "foreign/fdwapi.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/appendinfo.h"
#include "optimizer/pathnode.h"
#include "parser/parsetree.h"
#include "utils/lsyscache.h"
#include "utils/rel.h"
#include "utils/syscache.h"
Go to the source code of this file.
Data Structures | |
struct | adjust_appendrel_attrs_context |
void add_row_identity_columns | ( | PlannerInfo * | root, |
Index | rtindex, | ||
RangeTblEntry * | target_rte, | ||
Relation | target_relation | ||
) |
Definition at line 883 of file appendinfo.c.
References add_row_identity_var(), FdwRoutine::AddForeignUpdateTargets, Assert(), CMD_DELETE, CMD_MERGE, CMD_UPDATE, Query::commandType, GetFdwRoutineForRelation(), InvalidAttrNumber, InvalidOid, makeVar(), PlannerInfo::parse, RelationData::rd_rel, SelfItemPointerAttributeNumber, TriggerDesc::trig_delete_after_row, TriggerDesc::trig_delete_before_row, and RelationData::trigdesc.
Referenced by distribute_row_identity_vars(), expand_single_inheritance_child(), and preprocess_targetlist().
void add_row_identity_var | ( | PlannerInfo * | root, |
Var * | orig_var, | ||
Index | rtindex, | ||
const char * | rowid_name | ||
) |
Definition at line 788 of file appendinfo.c.
References Assert(), bms_add_member(), bms_is_member(), bms_make_singleton(), copyObject, elog(), equal(), ERROR, exprType(), exprTypmod(), get_typavgwidth(), IsA, lappend(), PlannerInfo::leaf_result_relids, lfirst, list_length(), makeNode, makeTargetEntry(), PlannerInfo::parse, PlannerInfo::processed_tlist, pstrdup(), PlannerInfo::row_identity_vars, ROWID_VAR, RowIdentityVarInfo::rowidname, RowIdentityVarInfo::rowidrels, RowIdentityVarInfo::rowidvar, RowIdentityVarInfo::rowidwidth, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by add_row_identity_columns(), expand_single_inheritance_child(), and postgresAddForeignUpdateTargets().
Node* adjust_appendrel_attrs | ( | PlannerInfo * | root, |
Node * | node, | ||
int | nappinfos, | ||
AppendRelInfo ** | appinfos | ||
) |
Definition at line 195 of file appendinfo.c.
References adjust_appendrel_attrs_mutator(), adjust_appendrel_attrs_context::appinfos, Assert(), IsA, adjust_appendrel_attrs_context::nappinfos, and adjust_appendrel_attrs_context::root.
Referenced by add_child_join_rel_equivalences(), add_child_rel_equivalences(), adjust_appendrel_attrs_multilevel(), apply_child_basequals(), apply_scanjoin_target_to_paths(), build_child_join_rel(), build_child_join_reltarget(), build_child_join_sjinfo(), create_partitionwise_grouping_paths(), make_partitionedrel_pruneinfo(), set_append_rel_size(), and try_partitionwise_join().
Node* adjust_appendrel_attrs_multilevel | ( | PlannerInfo * | root, |
Node * | node, | ||
RelOptInfo * | childrel, | ||
RelOptInfo * | parentrel | ||
) |
Definition at line 520 of file appendinfo.c.
References adjust_appendrel_attrs(), elog(), ERROR, find_appinfos_by_relids(), pfree(), and RelOptInfo::relids.
Referenced by add_child_join_rel_equivalences(), add_child_rel_equivalences(), generate_join_implied_equalities_broken(), get_translated_update_targetlist(), grouping_planner(), and make_partitionedrel_pruneinfo().
|
static |
Definition at line 214 of file appendinfo.c.
References adjust_child_relids(), adjust_appendrel_attrs_context::appinfos, ConvertRowtypeExpr::arg, RowExpr::args, Assert(), bms_is_member(), AppendRelInfo::child_relid, AppendRelInfo::child_reltype, RestrictInfo::clause, COERCE_IMPLICIT_CAST, Alias::colnames, copyObject, CurrentOfExpr::cvarno, elog(), RangeTblEntry::eref, ERROR, expression_tree_mutator, get_rel_name(), IsA, PlannerInfo::leaf_result_relids, list_length(), list_nth(), ConvertRowtypeExpr::location, RowExpr::location, makeNode, makeNullConst(), adjust_appendrel_attrs_context::nappinfos, NIL, OidIsValid, RestrictInfo::outer_relids, AppendRelInfo::parent_relid, AppendRelInfo::parent_reloid, AppendRelInfo::parent_reltype, PlannerInfo::parse, PlaceHolderVar::phlevelsup, RestrictInfo::required_relids, ConvertRowtypeExpr::resulttype, adjust_appendrel_attrs_context::root, PlannerInfo::row_identity_vars, ROWID_VAR, RowIdentityVarInfo::rowidrels, RowIdentityVarInfo::rowidvar, rt_fetch, Query::rtable, AppendRelInfo::translated_vars, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by adjust_appendrel_attrs().
Relids adjust_child_relids | ( | Relids | relids, |
int | nappinfos, | ||
AppendRelInfo ** | appinfos | ||
) |
Definition at line 553 of file appendinfo.c.
References bms_add_member(), bms_copy(), bms_del_member(), bms_is_member(), AppendRelInfo::child_relid, and AppendRelInfo::parent_relid.
Referenced by adjust_appendrel_attrs_mutator(), adjust_child_relids_multilevel(), and build_child_join_sjinfo().
Relids adjust_child_relids_multilevel | ( | PlannerInfo * | root, |
Relids | relids, | ||
RelOptInfo * | childrel, | ||
RelOptInfo * | parentrel | ||
) |
Definition at line 587 of file appendinfo.c.
References adjust_child_relids(), bms_overlap(), elog(), ERROR, find_appinfos_by_relids(), pfree(), and RelOptInfo::relids.
Referenced by reparameterize_path_by_child().
List* adjust_inherited_attnums | ( | List * | attnums, |
AppendRelInfo * | context | ||
) |
Definition at line 627 of file appendinfo.c.
References Assert(), elog(), ERROR, get_rel_name(), IsA, lappend_int(), lfirst_int, list_length(), list_nth(), NIL, OidIsValid, AppendRelInfo::parent_reloid, AppendRelInfo::translated_vars, and Var::varattno.
Referenced by adjust_inherited_attnums_multilevel().
List* adjust_inherited_attnums_multilevel | ( | PlannerInfo * | root, |
List * | attnums, | ||
Index | child_relid, | ||
Index | top_parent_relid | ||
) |
Definition at line 661 of file appendinfo.c.
References adjust_inherited_attnums(), elog(), ERROR, and AppendRelInfo::parent_relid.
Referenced by get_translated_update_targetlist(), and grouping_planner().
void distribute_row_identity_vars | ( | PlannerInfo * | root | ) |
Definition at line 965 of file appendinfo.c.
References add_row_identity_columns(), Assert(), CMD_DELETE, CMD_MERGE, CMD_UPDATE, copyObject, TargetEntry::expr, PathTarget::exprs, find_base_rel(), if(), RangeTblEntry::inh, IsA, lappend(), lfirst, NIL, NoLock, parse(), PlannerInfo::parse, PlannerInfo::processed_tlist, RangeTblEntry::relid, RelOptInfo::reltarget, PlannerInfo::row_identity_vars, ROWID_VAR, rt_fetch, table_close(), table_open(), and Var::varno.
Referenced by query_planner().
AppendRelInfo** find_appinfos_by_relids | ( | PlannerInfo * | root, |
Relids | relids, | ||
int * | nappinfos | ||
) |
Definition at line 732 of file appendinfo.c.
References bms_next_member(), bms_num_members(), elog(), ERROR, find_base_rel_ignore_join(), i, and palloc().
Referenced by adjust_appendrel_attrs_multilevel(), adjust_child_relids_multilevel(), apply_scanjoin_target_to_paths(), build_child_join_rel(), build_child_join_sjinfo(), create_partitionwise_grouping_paths(), make_partitionedrel_pruneinfo(), and try_partitionwise_join().
void get_translated_update_targetlist | ( | PlannerInfo * | root, |
Index | relid, | ||
List ** | processed_tlist, | ||
List ** | update_colnos | ||
) |
Definition at line 689 of file appendinfo.c.
References adjust_appendrel_attrs_multilevel(), adjust_inherited_attnums_multilevel(), PlannerInfo::all_result_relids, Assert(), bms_is_member(), CMD_UPDATE, Query::commandType, copyObject, find_base_rel(), PlannerInfo::parse, PlannerInfo::processed_tlist, and PlannerInfo::update_colnos.
Referenced by postgresPlanDirectModify().
AppendRelInfo* make_append_rel_info | ( | Relation | parentrel, |
Relation | childrel, | ||
Index | parentRTindex, | ||
Index | childRTindex | ||
) |
Definition at line 50 of file appendinfo.c.
References AppendRelInfo::child_relid, AppendRelInfo::child_reltype, make_inh_translation_list(), makeNode, AppendRelInfo::parent_relid, AppendRelInfo::parent_reloid, AppendRelInfo::parent_reltype, RelationData::rd_rel, and RelationGetRelid.
Referenced by expand_single_inheritance_child().
|
static |
Definition at line 79 of file appendinfo.c.
References Assert(), attname, attnum, elog(), ERROR, GETSTRUCT, HeapTupleIsValid, lappend(), makeVar(), NameStr, TupleDescData::natts, NIL, AppendRelInfo::num_child_cols, palloc0(), RelationGetDescr, RelationGetRelationName, RelationGetRelid, ReleaseSysCache(), SearchSysCacheAttName(), AppendRelInfo::translated_vars, and TupleDescAttr.
Referenced by make_append_rel_info().