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 "optimizer/planmain.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 888 of file appendinfo.c.
References add_row_identity_var(), FdwRoutine::AddForeignUpdateTargets, Assert, CMD_DELETE, CMD_MERGE, CMD_UPDATE, GetFdwRoutineForRelation(), InvalidAttrNumber, InvalidOid, makeVar(), RelationData::rd_rel, root, 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 793 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(), lfirst, list_length(), makeNode, makeTargetEntry(), pstrdup(), root, 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 200 of file appendinfo.c.
References adjust_appendrel_attrs_mutator(), Assert, context, IsA, and 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 525 of file appendinfo.c.
References adjust_appendrel_attrs(), elog, ERROR, find_appinfos_by_relids(), pfree(), RelOptInfo::relids, and root.
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 219 of file appendinfo.c.
References adjust_child_relids(), ConvertRowtypeExpr::arg, RowExpr::args, Assert, bms_is_member(), AppendRelInfo::child_relid, AppendRelInfo::child_reltype, RestrictInfo::clause, COERCE_IMPLICIT_CAST, context, copyObject, CurrentOfExpr::cvarno, elog, ERROR, expression_tree_mutator, get_rel_name(), IsA, list_length(), list_nth(), ConvertRowtypeExpr::location, RowExpr::location, makeNode, makeNullConst(), NIL, OidIsValid, RestrictInfo::outer_relids, AppendRelInfo::parent_relid, AppendRelInfo::parent_reloid, AppendRelInfo::parent_reltype, PlaceHolderVar::phlevelsup, RestrictInfo::required_relids, ConvertRowtypeExpr::resulttype, ROWID_VAR, RowIdentityVarInfo::rowidrels, RowIdentityVarInfo::rowidvar, rt_fetch, 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 558 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(), build_child_join_rel(), build_child_join_sjinfo(), and try_partitionwise_join().
Relids adjust_child_relids_multilevel | ( | PlannerInfo * | root, |
Relids | relids, | ||
RelOptInfo * | childrel, | ||
RelOptInfo * | parentrel | ||
) |
Definition at line 592 of file appendinfo.c.
References adjust_child_relids(), bms_overlap(), elog, ERROR, find_appinfos_by_relids(), pfree(), RelOptInfo::relids, and root.
Referenced by reparameterize_path_by_child().
List* adjust_inherited_attnums | ( | List * | attnums, |
AppendRelInfo * | context | ||
) |
Definition at line 632 of file appendinfo.c.
References Assert, context, elog, ERROR, get_rel_name(), IsA, lappend_int(), lfirst_int, list_length(), list_nth(), NIL, OidIsValid, 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 666 of file appendinfo.c.
References adjust_inherited_attnums(), elog, ERROR, AppendRelInfo::parent_relid, and root.
Referenced by get_translated_update_targetlist(), and grouping_planner().
void distribute_row_identity_vars | ( | PlannerInfo * | root | ) |
Definition at line 969 of file appendinfo.c.
References add_row_identity_columns(), Assert, build_base_rel_tlists(), CMD_DELETE, CMD_MERGE, CMD_UPDATE, copyObject, TargetEntry::expr, PathTarget::exprs, find_base_rel(), if(), RangeTblEntry::inh, IsA, lappend(), lfirst, NIL, NoLock, parse(), RangeTblEntry::relid, RelOptInfo::reltarget, root, 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 737 of file appendinfo.c.
References bms_next_member(), bms_num_members(), elog, ERROR, find_base_rel_ignore_join(), i, palloc(), and root.
Referenced by adjust_appendrel_attrs_multilevel(), adjust_child_relids_multilevel(), apply_scanjoin_target_to_paths(), 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 694 of file appendinfo.c.
References adjust_appendrel_attrs_multilevel(), adjust_inherited_attnums_multilevel(), Assert, bms_is_member(), CMD_UPDATE, copyObject, find_base_rel(), and root.
Referenced by postgresPlanDirectModify().
AppendRelInfo* make_append_rel_info | ( | Relation | parentrel, |
Relation | childrel, | ||
Index | parentRTindex, | ||
Index | childRTindex | ||
) |
Definition at line 51 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 80 of file appendinfo.c.
References Assert, attname, attnum, elog, ereport, errcode(), errmsg(), 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().