PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/cost.h"
#include "optimizer/optimizer.h"
#include "optimizer/pathnode.h"
#include "optimizer/placeholder.h"
#include "optimizer/planmain.h"
#include "utils/lsyscache.h"
Go to the source code of this file.
Data Structures | |
struct | contain_placeholder_references_context |
Typedefs | |
typedef struct contain_placeholder_references_context | contain_placeholder_references_context |
Functions | |
static void | find_placeholders_recurse (PlannerInfo *root, Node *jtnode) |
static void | find_placeholders_in_expr (PlannerInfo *root, Node *expr) |
static bool | contain_placeholder_references_walker (Node *node, contain_placeholder_references_context *context) |
PlaceHolderVar * | make_placeholder_expr (PlannerInfo *root, Expr *expr, Relids phrels) |
PlaceHolderInfo * | find_placeholder_info (PlannerInfo *root, PlaceHolderVar *phv) |
void | find_placeholders_in_jointree (PlannerInfo *root) |
void | fix_placeholder_input_needed_levels (PlannerInfo *root) |
void | rebuild_placeholder_attr_needed (PlannerInfo *root) |
void | add_placeholders_to_base_rels (PlannerInfo *root) |
void | add_placeholders_to_joinrel (PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo) |
bool | contain_placeholder_references_to (PlannerInfo *root, Node *clause, int relid) |
void add_placeholders_to_base_rels | ( | PlannerInfo * | root | ) |
Definition at line 356 of file placeholder.c.
References Assert, bms_get_singleton_member(), bms_nonempty_difference(), copyObject, PathTarget::exprs, find_base_rel(), lappend(), lfirst, PlaceHolderInfo::ph_eval_at, PlaceHolderInfo::ph_needed, PlaceHolderInfo::ph_var, PlaceHolderVar::phnullingrels, RelOptInfo::reltarget, and root.
Referenced by query_planner().
void add_placeholders_to_joinrel | ( | PlannerInfo * | root, |
RelOptInfo * | joinrel, | ||
RelOptInfo * | outer_rel, | ||
RelOptInfo * | inner_rel, | ||
SpecialJoinInfo * | sjinfo | ||
) |
Definition at line 400 of file placeholder.c.
References Assert, bms_add_members(), bms_is_subset(), bms_nonempty_difference(), clamp_width_est(), copyObject, PathTarget::cost, cost_qual_eval_node(), RelOptInfo::direct_lateral_relids, PathTarget::exprs, lappend(), lfirst, QualCost::per_tuple, PlaceHolderInfo::ph_eval_at, PlaceHolderInfo::ph_lateral, PlaceHolderInfo::ph_needed, PlaceHolderInfo::ph_var, PlaceHolderInfo::ph_width, PlaceHolderVar::phnullingrels, RelOptInfo::relids, RelOptInfo::reltarget, root, QualCost::startup, and PathTarget::width.
Referenced by build_join_rel().
bool contain_placeholder_references_to | ( | PlannerInfo * | root, |
Node * | clause, | ||
int | relid | ||
) |
Definition at line 491 of file placeholder.c.
References contain_placeholder_references_walker(), context, and root.
Referenced by make_outerjoininfo().
|
static |
Definition at line 506 of file placeholder.c.
References bms_is_member(), context, expression_tree_walker, IsA, PlaceHolderVar::phlevelsup, and query_tree_walker.
Referenced by contain_placeholder_references_to().
PlaceHolderInfo* find_placeholder_info | ( | PlannerInfo * | root, |
PlaceHolderVar * | phv | ||
) |
Definition at line 83 of file placeholder.c.
References Assert, bms_copy(), bms_difference(), bms_int_members(), bms_is_empty, copyObject, elog, ERROR, exprType(), exprTypmod(), find_placeholders_in_expr(), get_typavgwidth(), lappend(), makeNode, palloc0_array, PlaceHolderInfo::ph_eval_at, PlaceHolderInfo::ph_lateral, PlaceHolderInfo::ph_needed, PlaceHolderInfo::ph_var, PlaceHolderInfo::ph_width, PlaceHolderVar::phid, PlaceHolderInfo::phid, PlaceHolderVar::phlevelsup, PlaceHolderVar::phnullingrels, pull_varnos(), repalloc0_array, and root.
Referenced by add_vars_to_attr_needed(), add_vars_to_targetlist(), build_joinrel_tlist(), create_lateral_join_info(), extract_lateral_vars_from_PHVs(), find_placeholders_in_expr(), identify_current_nestloop_params(), process_subquery_nestloop_params(), replace_nestloop_params_mutator(), and set_rel_width().
|
static |
Definition at line 257 of file placeholder.c.
References find_placeholder_info(), IsA, lfirst, list_free(), pull_var_clause(), PVC_INCLUDE_PLACEHOLDERS, PVC_RECURSE_AGGREGATES, PVC_RECURSE_WINDOWFUNCS, and root.
Referenced by find_placeholder_info(), and find_placeholders_recurse().
void find_placeholders_in_jointree | ( | PlannerInfo * | root | ) |
Definition at line 185 of file placeholder.c.
References Assert, find_placeholders_recurse(), IsA, and root.
Referenced by query_planner().
|
static |
Definition at line 207 of file placeholder.c.
References elog, ERROR, find_placeholders_in_expr(), FromExpr::fromlist, IsA, j, lfirst, nodeTag, FromExpr::quals, and root.
Referenced by find_placeholders_in_jointree().
void fix_placeholder_input_needed_levels | ( | PlannerInfo * | root | ) |
Definition at line 300 of file placeholder.c.
References add_vars_to_targetlist(), lfirst, list_free(), PlaceHolderInfo::ph_eval_at, PlaceHolderInfo::ph_var, pull_var_clause(), PVC_INCLUDE_PLACEHOLDERS, PVC_RECURSE_AGGREGATES, PVC_RECURSE_WINDOWFUNCS, and root.
Referenced by query_planner().
PlaceHolderVar* make_placeholder_expr | ( | PlannerInfo * | root, |
Expr * | expr, | ||
Relids | phrels | ||
) |
Definition at line 54 of file placeholder.c.
References makeNode, PlaceHolderVar::phid, PlaceHolderVar::phlevelsup, PlaceHolderVar::phnullingrels, and root.
Referenced by add_nullingrels_if_needed(), mark_nullable_by_grouping(), and pullup_replace_vars_callback().
void rebuild_placeholder_attr_needed | ( | PlannerInfo * | root | ) |
Definition at line 327 of file placeholder.c.
References add_vars_to_attr_needed(), lfirst, list_free(), PlaceHolderInfo::ph_eval_at, PlaceHolderInfo::ph_var, pull_var_clause(), PVC_INCLUDE_PLACEHOLDERS, PVC_RECURSE_AGGREGATES, PVC_RECURSE_WINDOWFUNCS, and root.
Referenced by remove_rel_from_query().