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 1134 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 1260 of file var.c.
References 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().
Definition at line 1322 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().
Definition at line 408 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().
Definition at line 414 of file var.c.
References context, expression_tree_walker, and IsA.
Referenced by contain_var_clause().
Definition at line 446 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().
Definition at line 457 of file var.c.
References expression_tree_walker, IsA, and query_tree_walker.
Referenced by contain_vars_of_level().
Node* flatten_group_exprs | ( | PlannerInfo * | root, |
Query * | query, | ||
Node * | node | ||
) |
Definition at line 929 of file var.c.
References Assert, context, flatten_group_exprs_mutator(), and root.
Referenced by get_query_def(), and subquery_planner().
|
static |
Definition at line 952 of file var.c.
References Aggref::aggdirectargs, GroupingFunc::agglevelsup, Assert, checkExprHasSubLink(), context, copyObject, expression_tree_mutator, IncrementVarSublevelsUp(), IsA, list_nth(), Var::location, mark_nullable_by_grouping(), QTW_IGNORE_GROUPEXPRS, query_tree_mutator, rt_fetch, RTE_GROUP, RangeTblEntry::rtekind, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by flatten_group_exprs().
Node* flatten_join_alias_vars | ( | PlannerInfo * | root, |
Query * | query, | ||
Node * | node | ||
) |
Definition at line 749 of file var.c.
References Assert, context, flatten_join_alias_vars_mutator(), and root.
Referenced by finalize_grouping_exprs_walker(), parseCheckAggregates(), preprocess_expression(), pull_up_simple_subquery(), and subquery_planner().
|
static |
Definition at line 772 of file var.c.
References add_nullingrels_if_needed(), alias_relid_set(), RowExpr::args, Assert, checkExprHasSubLink(), COERCE_IMPLICIT_CAST, context, copyObject, expression_tree_mutator, forboth, IncrementVarSublevelsUp(), InvalidAttrNumber, IsA, lappend(), lfirst, list_length(), list_nth(), Var::location, RowExpr::location, makeNode, NIL, PlaceHolderVar::phlevelsup, QTW_IGNORE_JOINALIASES, query_tree_mutator, rt_fetch, RTE_JOIN, RangeTblEntry::rtekind, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by flatten_join_alias_vars().
Definition at line 1186 of file var.c.
References RelabelType::arg, CoerceViaIO::arg, ArrayCoerceExpr::arg, FuncExpr::args, CoalesceExpr::args, Assert, COERCE_IMPLICIT_CAST, IsA, lfirst, linitial, NIL, and Var::varlevelsup.
Referenced by add_nullingrels_if_needed().
int locate_var_of_level | ( | Node * | node, |
int | levelsup | ||
) |
Definition at line 514 of file var.c.
References context, locate_var_of_level_walker(), and query_or_expression_tree_walker.
Referenced by check_agg_arguments(), checkExprIsVarFree(), and transformSetOperationTree().
|
static |
Definition at line 530 of file var.c.
References context, expression_tree_walker, IsA, Var::location, query_tree_walker, and Var::varlevelsup.
Referenced by locate_var_of_level().
|
static |
Definition at line 1064 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 612 of file var.c.
References Assert, context, NIL, pull_var_clause_walker(), PVC_INCLUDE_AGGREGATES, PVC_INCLUDE_PLACEHOLDERS, PVC_INCLUDE_WINDOWFUNCS, PVC_RECURSE_AGGREGATES, PVC_RECURSE_PLACEHOLDERS, and PVC_RECURSE_WINDOWFUNCS.
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 632 of file var.c.
References context, elog, ERROR, expression_tree_walker, IsA, lappend(), PVC_INCLUDE_AGGREGATES, PVC_INCLUDE_PLACEHOLDERS, PVC_INCLUDE_WINDOWFUNCS, PVC_RECURSE_AGGREGATES, PVC_RECURSE_PLACEHOLDERS, and PVC_RECURSE_WINDOWFUNCS.
Referenced by pull_var_clause().
Definition at line 296 of file var.c.
References context, and pull_varattnos_walker().
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(), context, expression_tree_walker, FirstLowInvalidHeapAttributeNumber, IsA, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by pull_varattnos().
Relids pull_varnos | ( | PlannerInfo * | root, |
Node * | node | ||
) |
Definition at line 113 of file var.c.
References context, pull_varnos_walker(), query_or_expression_tree_walker, and root.
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 139 of file var.c.
References context, pull_varnos_walker(), query_or_expression_tree_walker, and root.
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 160 of file var.c.
References bms_add_member(), bms_add_members(), bms_difference(), bms_equal(), bms_join(), context, CurrentOfExpr::cvarno, expression_tree_walker, IsA, PlaceHolderInfo::ph_eval_at, PlaceHolderInfo::ph_var, PlaceHolderVar::phid, PlaceHolderVar::phlevelsup, PlaceHolderVar::phnullingrels, query_tree_walker, Var::varlevelsup, and Var::varno.
Referenced by pull_varnos(), and pull_varnos_of_level().
Definition at line 340 of file var.c.
References context, NIL, pull_vars_walker(), and query_or_expression_tree_walker.
Referenced by extract_lateral_references(), and extract_lateral_vars_from_PHVs().
|
static |
Definition at line 360 of file var.c.
References context, expression_tree_walker, IsA, lappend(), PlaceHolderVar::phlevelsup, query_tree_walker, and Var::varlevelsup.
Referenced by pull_vars_of_level().