PostgreSQL Source Code git master
|
#include "postgres.h"
#include "access/sysattr.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/clauses.h"
#include "optimizer/optimizer.h"
#include "optimizer/placeholder.h"
#include "optimizer/prep.h"
#include "parser/parsetree.h"
#include "rewrite/rewriteManip.h"
Go to the source code of this file.
Data Structures | |
struct | pull_varnos_context |
struct | pull_varattnos_context |
struct | pull_vars_context |
struct | locate_var_of_level_context |
struct | pull_var_clause_context |
struct | flatten_join_alias_vars_context |
|
static |
Definition at line 1173 of file var.c.
References adjust_standard_join_alias_expression(), Assert, bms_copy(), bms_del_member(), bms_is_empty, elog, ERROR, get_relids_for_join(), is_standard_join_alias_expression(), make_placeholder_expr(), PlaceHolderVar::phlevelsup, PlaceHolderVar::phnullingrels, pull_varnos_of_level(), root, Var::varlevelsup, and Var::varno.
Referenced by flatten_join_alias_vars_mutator().
Definition at line 1299 of file var.c.
References adjust_standard_join_alias_expression(), RelabelType::arg, CoerceViaIO::arg, ArrayCoerceExpr::arg, FuncExpr::args, CoalesceExpr::args, Assert, bms_add_members(), IsA, lfirst, linitial, NIL, PlaceHolderVar::phnullingrels, and Var::varlevelsup.
Referenced by add_nullingrels_if_needed(), and adjust_standard_join_alias_expression().
Definition at line 1361 of file var.c.
References bms_add_member(), bms_join(), bms_next_member(), get_relids_for_join(), rt_fetch, Query::rtable, RTE_JOIN, and RangeTblEntry::rtekind.
Referenced by flatten_join_alias_vars_mutator().
bool contain_var_clause | ( | Node * | node | ) |
Definition at line 406 of file var.c.
References contain_var_clause_walker().
Referenced by contain_leaked_vars_walker(), cookDefault(), domainAddCheckConstraint(), interpret_function_parameter_list(), is_pseudo_constant_clause(), match_clause_to_ordering_op(), match_clause_to_partition_key(), test_opexpr_is_hashable(), transformJsonBehavior(), and transformPartitionBoundValue().
|
static |
Definition at line 412 of file var.c.
References contain_var_clause_walker(), expression_tree_walker, and IsA.
Referenced by contain_var_clause(), and contain_var_clause_walker().
bool contain_vars_of_level | ( | Node * | node, |
int | levelsup | ||
) |
Definition at line 444 of file var.c.
References contain_vars_of_level_walker(), and query_or_expression_tree_walker.
Referenced by apply_child_basequals(), checkExprIsVarFree(), convert_EXISTS_sublink_to_join(), convert_EXISTS_to_ANY(), pull_up_simple_values(), pullup_replace_vars_callback(), rewriteRuleAction(), transformAExprIn(), transformJsonTable(), transformRangeFunction(), transformRangeTableFunc(), transformSetOperationTree(), and transformValuesClause().
|
static |
Definition at line 455 of file var.c.
References contain_vars_of_level_walker(), expression_tree_walker, IsA, and query_tree_walker.
Referenced by contain_vars_of_level(), and contain_vars_of_level_walker().
bool contain_vars_returning_old_or_new | ( | Node * | node | ) |
Definition at line 511 of file var.c.
References contain_vars_returning_old_or_new_walker().
Referenced by make_modifytable().
|
static |
Definition at line 517 of file var.c.
References contain_vars_returning_old_or_new_walker(), expression_tree_walker, IsA, and VAR_RETURNING_DEFAULT.
Referenced by contain_vars_returning_old_or_new(), and contain_vars_returning_old_or_new_walker().
Node * flatten_group_exprs | ( | PlannerInfo * | root, |
Query * | query, | ||
Node * | node | ||
) |
Definition at line 968 of file var.c.
References Assert, flatten_group_exprs_mutator(), flatten_join_alias_vars_context::inserted_sublink, flatten_join_alias_vars_context::possible_sublink, flatten_join_alias_vars_context::query, flatten_join_alias_vars_context::root, root, and flatten_join_alias_vars_context::sublevels_up.
Referenced by get_query_def(), and subquery_planner().
|
static |
Definition at line 991 of file var.c.
References Aggref::aggdirectargs, GroupingFunc::agglevelsup, Assert, checkExprHasSubLink(), copyObject, expression_tree_mutator, flatten_group_exprs_mutator(), IncrementVarSublevelsUp(), flatten_join_alias_vars_context::inserted_sublink, IsA, list_nth(), Var::location, mark_nullable_by_grouping(), flatten_join_alias_vars_context::possible_sublink, QTW_IGNORE_GROUPEXPRS, flatten_join_alias_vars_context::query, query_tree_mutator, flatten_join_alias_vars_context::root, rt_fetch, Query::rtable, RTE_GROUP, RangeTblEntry::rtekind, flatten_join_alias_vars_context::sublevels_up, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by flatten_group_exprs(), and flatten_group_exprs_mutator().
Node * flatten_join_alias_vars | ( | PlannerInfo * | root, |
Query * | query, | ||
Node * | node | ||
) |
Definition at line 789 of file var.c.
References Assert, flatten_join_alias_vars_mutator(), flatten_join_alias_vars_context::inserted_sublink, flatten_join_alias_vars_context::possible_sublink, flatten_join_alias_vars_context::query, flatten_join_alias_vars_context::root, root, and flatten_join_alias_vars_context::sublevels_up.
Referenced by finalize_grouping_exprs_walker(), parseCheckAggregates(), preprocess_expression(), pull_up_simple_subquery(), and subquery_planner().
|
static |
Definition at line 812 of file var.c.
References add_nullingrels_if_needed(), alias_relid_set(), RowExpr::args, Assert, checkExprHasSubLink(), COERCE_IMPLICIT_CAST, copyObject, expression_tree_mutator, flatten_join_alias_vars_mutator(), forboth, IncrementVarSublevelsUp(), flatten_join_alias_vars_context::inserted_sublink, InvalidAttrNumber, IsA, lappend(), lfirst, list_length(), list_nth(), Var::location, RowExpr::location, makeNode, NIL, PlaceHolderVar::phlevelsup, flatten_join_alias_vars_context::possible_sublink, QTW_IGNORE_JOINALIASES, flatten_join_alias_vars_context::query, query_tree_mutator, flatten_join_alias_vars_context::root, rt_fetch, Query::rtable, RTE_JOIN, RangeTblEntry::rtekind, flatten_join_alias_vars_context::sublevels_up, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by flatten_join_alias_vars(), and flatten_join_alias_vars_mutator().
Definition at line 1225 of file var.c.
References RelabelType::arg, CoerceViaIO::arg, ArrayCoerceExpr::arg, FuncExpr::args, CoalesceExpr::args, Assert, COERCE_IMPLICIT_CAST, is_standard_join_alias_expression(), IsA, lfirst, linitial, NIL, and Var::varlevelsup.
Referenced by add_nullingrels_if_needed(), and is_standard_join_alias_expression().
int locate_var_of_level | ( | Node * | node, |
int | levelsup | ||
) |
Definition at line 555 of file var.c.
References locate_var_of_level_walker(), query_or_expression_tree_walker, locate_var_of_level_context::sublevels_up, and locate_var_of_level_context::var_location.
Referenced by check_agg_arguments(), checkExprIsVarFree(), and transformSetOperationTree().
|
static |
Definition at line 571 of file var.c.
References expression_tree_walker, IsA, locate_var_of_level_walker(), Var::location, query_tree_walker, locate_var_of_level_context::sublevels_up, locate_var_of_level_context::var_location, and Var::varlevelsup.
Referenced by locate_var_of_level(), and locate_var_of_level_walker().
|
static |
Definition at line 1103 of file var.c.
References add_nulling_relids(), Assert, bms_copy(), bms_equal(), bms_is_empty, bms_make_singleton(), contain_agg_clause(), contain_volatile_functions(), contain_window_function(), expression_returns_set(), get_relids_in_jointree(), make_placeholder_expr(), PlaceHolderVar::phlevelsup, PlaceHolderVar::phnullingrels, pull_varnos_of_level(), root, and Var::varlevelsup.
Referenced by flatten_group_exprs_mutator().
Definition at line 653 of file var.c.
References Assert, pull_var_clause_context::flags, NIL, pull_var_clause_walker(), PVC_INCLUDE_AGGREGATES, PVC_INCLUDE_PLACEHOLDERS, PVC_INCLUDE_WINDOWFUNCS, PVC_RECURSE_AGGREGATES, PVC_RECURSE_PLACEHOLDERS, PVC_RECURSE_WINDOWFUNCS, and pull_var_clause_context::varlist.
Referenced by add_paths_with_pathkeys_for_rel(), AddRelationNewConstraints(), build_base_rel_tlists(), build_remote_returning(), build_tlist_to_deparse(), CreateTriggerFiringOn(), distribute_qual_to_rels(), estimate_num_groups(), find_computable_ec_member(), find_placeholders_in_expr(), fix_placeholder_input_needed_levels(), foreign_grouping_ok(), generate_base_implied_equalities_no_const(), make_group_input_target(), make_partial_grouping_target(), make_sort_input_target(), make_window_input_target(), preprocess_targetlist(), process_implied_equality(), qual_is_pushdown_safe(), rebuild_eclass_attr_needed(), rebuild_joinclause_attr_needed(), rebuild_placeholder_attr_needed(), semijoin_target_ok(), and StoreRelCheck().
|
static |
Definition at line 673 of file var.c.
References elog, ERROR, expression_tree_walker, pull_var_clause_context::flags, IsA, lappend(), pull_var_clause_walker(), PVC_INCLUDE_AGGREGATES, PVC_INCLUDE_PLACEHOLDERS, PVC_INCLUDE_WINDOWFUNCS, PVC_RECURSE_AGGREGATES, PVC_RECURSE_PLACEHOLDERS, PVC_RECURSE_WINDOWFUNCS, and pull_var_clause_context::varlist.
Referenced by pull_var_clause(), and pull_var_clause_walker().
Definition at line 296 of file var.c.
References pull_varattnos_walker(), pull_varattnos_context::varattnos, and pull_varattnos_context::varno.
Referenced by check_index_only(), check_selective_binary_conversion(), ComputePartitionAttrs(), create_foreignscan_plan(), CreateStatistics(), DefineIndex(), deparseReturningList(), ExecInitStoredGenerated(), get_dependent_generated_columns(), has_partition_attrs(), postgresGetForeignRelSize(), RelationGetIndexAttrBitmap(), remove_unused_subquery_outputs(), and statext_is_compatible_clause().
|
static |
Definition at line 309 of file var.c.
References Assert, bms_add_member(), expression_tree_walker, FirstLowInvalidHeapAttributeNumber, IsA, pull_varattnos_walker(), Var::varattno, pull_varattnos_context::varattnos, Var::varlevelsup, pull_varattnos_context::varno, and Var::varno.
Referenced by pull_varattnos(), and pull_varattnos_walker().
Relids pull_varnos | ( | PlannerInfo * | root, |
Node * | node | ||
) |
Definition at line 114 of file var.c.
References pull_varnos_walker(), query_or_expression_tree_walker, pull_varnos_context::root, root, pull_varnos_context::sublevels_up, and pull_varnos_context::varnos.
Referenced by compute_semijoin_info(), convert_ANY_sublink_to_join(), convert_EXISTS_sublink_to_join(), cost_incremental_sort(), distribute_qual_to_rels(), examine_variable(), expand_indexqual_rowcompare(), extract_lateral_vars_from_PHVs(), find_placeholder_info(), get_eclass_for_sort_expr(), is_pseudo_constant_for_index(), IsTidEqualAnyClause(), join_is_removable(), make_outerjoininfo(), make_plain_restrictinfo(), match_rowcompare_to_indexcol(), match_saopclause_to_indexcol(), NumRelids(), pg_get_expr_worker(), process_implied_equality(), pullup_replace_vars_callback(), remove_rel_from_query(), and subquery_planner().
Relids pull_varnos_of_level | ( | PlannerInfo * | root, |
Node * | node, | ||
int | levelsup | ||
) |
Definition at line 140 of file var.c.
References pull_varnos_walker(), query_or_expression_tree_walker, pull_varnos_context::root, root, pull_varnos_context::sublevels_up, and pull_varnos_context::varnos.
Referenced by add_nullingrels_if_needed(), convert_ANY_sublink_to_join(), is_simple_subquery(), jointree_contains_lateral_outer_refs(), and mark_nullable_by_grouping().
|
static |
Definition at line 161 of file var.c.
References bms_add_member(), bms_add_members(), bms_difference(), bms_equal(), bms_join(), CurrentOfExpr::cvarno, expression_tree_walker, IsA, PlaceHolderInfo::ph_eval_at, PlaceHolderInfo::ph_var, PlaceHolderVar::phid, PlaceHolderVar::phlevelsup, PlaceHolderVar::phnullingrels, pull_varnos_walker(), query_tree_walker, pull_varnos_context::root, pull_varnos_context::sublevels_up, Var::varlevelsup, Var::varno, and pull_varnos_context::varnos.
Referenced by pull_varnos(), pull_varnos_of_level(), and pull_varnos_walker().
Definition at line 339 of file var.c.
References NIL, pull_vars_walker(), query_or_expression_tree_walker, pull_vars_context::sublevels_up, and pull_vars_context::vars.
Referenced by extract_lateral_references(), and extract_lateral_vars_from_PHVs().
|
static |
Definition at line 359 of file var.c.
References expression_tree_walker, IsA, lappend(), PlaceHolderVar::phlevelsup, pull_vars_walker(), query_tree_walker, pull_vars_context::sublevels_up, Var::varlevelsup, and pull_vars_context::vars.
Referenced by pull_vars_of_level(), and pull_vars_walker().