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 | 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 329 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, PlannerInfo::placeholder_list, and RelOptInfo::reltarget.
Referenced by query_planner().
void add_placeholders_to_joinrel | ( | PlannerInfo * | root, |
RelOptInfo * | joinrel, | ||
RelOptInfo * | outer_rel, | ||
RelOptInfo * | inner_rel, | ||
SpecialJoinInfo * | sjinfo | ||
) |
Definition at line 373 of file placeholder.c.
References Assert(), bms_add_members(), bms_is_subset(), bms_nonempty_difference(), 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, PlannerInfo::placeholder_list, RelOptInfo::relids, RelOptInfo::reltarget, QualCost::startup, and PathTarget::width.
Referenced by build_join_rel().
bool contain_placeholder_references_to | ( | PlannerInfo * | root, |
Node * | clause, | ||
int | relid | ||
) |
Definition at line 461 of file placeholder.c.
References contain_placeholder_references_walker(), PlannerInfo::glob, PlannerGlobal::lastPHId, contain_placeholder_references_context::relid, and contain_placeholder_references_context::sublevels_up.
Referenced by make_outerjoininfo().
|
static |
Definition at line 476 of file placeholder.c.
References bms_is_member(), expression_tree_walker, IsA, PlaceHolderVar::phlevelsup, query_tree_walker, contain_placeholder_references_context::relid, and contain_placeholder_references_context::sublevels_up.
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, PlannerInfo::placeholder_list, PlannerInfo::placeholdersFrozen, pull_varnos(), and repalloc0_array.
Referenced by add_vars_to_targetlist(), build_joinrel_tlist(), create_lateral_join_info(), 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, and PVC_RECURSE_WINDOWFUNCS.
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(), PlannerInfo::glob, IsA, Query::jointree, PlannerGlobal::lastPHId, PlannerInfo::parse, and PlannerInfo::placeholdersFrozen.
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, and FromExpr::quals.
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, PlannerInfo::placeholder_list, pull_var_clause(), PVC_INCLUDE_PLACEHOLDERS, PVC_RECURSE_AGGREGATES, and PVC_RECURSE_WINDOWFUNCS.
Referenced by query_planner().
PlaceHolderVar* make_placeholder_expr | ( | PlannerInfo * | root, |
Expr * | expr, | ||
Relids | phrels | ||
) |
Definition at line 54 of file placeholder.c.
References PlannerInfo::glob, PlannerGlobal::lastPHId, makeNode, PlaceHolderVar::phid, PlaceHolderVar::phlevelsup, and PlaceHolderVar::phnullingrels.
Referenced by add_nullingrels_if_needed(), and pullup_replace_vars_callback().