|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/htup_details.h"#include "catalog/pg_class.h"#include "catalog/pg_language.h"#include "catalog/pg_operator.h"#include "catalog/pg_proc.h"#include "catalog/pg_type.h"#include "executor/executor.h"#include "executor/functions.h"#include "funcapi.h"#include "miscadmin.h"#include "nodes/makefuncs.h"#include "nodes/multibitmapset.h"#include "nodes/nodeFuncs.h"#include "nodes/subscripting.h"#include "nodes/supportnodes.h"#include "optimizer/clauses.h"#include "optimizer/cost.h"#include "optimizer/optimizer.h"#include "optimizer/pathnode.h"#include "optimizer/plancat.h"#include "optimizer/planmain.h"#include "parser/analyze.h"#include "parser/parse_coerce.h"#include "parser/parse_collate.h"#include "parser/parse_func.h"#include "parser/parse_oper.h"#include "parser/parsetree.h"#include "rewrite/rewriteHandler.h"#include "rewrite/rewriteManip.h"#include "tcop/tcopprot.h"#include "utils/acl.h"#include "utils/builtins.h"#include "utils/datum.h"#include "utils/fmgroids.h"#include "utils/json.h"#include "utils/jsonb.h"#include "utils/jsonpath.h"#include "utils/lsyscache.h"#include "utils/memutils.h"#include "utils/syscache.h"#include "utils/typcache.h"
Go to the source code of this file.
Data Structures | |
| struct | eval_const_expressions_context |
| struct | substitute_actual_parameters_context |
| struct | substitute_actual_parameters_in_from_context |
| struct | inline_error_callback_arg |
| struct | max_parallel_hazard_context |
Macros | |
| #define | CCDN_CASETESTEXPR_OK 0x0001 /* CaseTestExpr okay here? */ |
| #define | MIN_ARRAY_SIZE_FOR_HASHED_SAOP 9 |
| #define | ece_generic_processing(node) |
| #define | ece_all_arguments_const(node) (!expression_tree_walker((Node *) (node), contain_non_const_walker, NULL)) |
| #define | ece_evaluate_expr(node) |
| #define CCDN_CASETESTEXPR_OK 0x0001 /* CaseTestExpr okay here? */ |
| #define ece_all_arguments_const | ( | node | ) | (!expression_tree_walker((Node *) (node), contain_non_const_walker, NULL)) |
Definition at line 2439 of file clauses.c.
| #define ece_evaluate_expr | ( | node | ) |
| #define ece_generic_processing | ( | node | ) |
Definition at line 4638 of file clauses.c.
References elog, ERROR, fb(), fetch_function_defaults(), list_concat_copy(), list_delete_first_n(), list_length(), and pronargs.
Referenced by expand_function_arguments().
Definition at line 2159 of file clauses.c.
References OpExpr::args, elog, ERROR, fb(), get_commutator(), InvalidOid, is_opclause(), linitial, list_length(), lsecond, OidIsValid, and OpExpr::opno.
Referenced by get_switched_clauses().
Definition at line 190 of file clauses.c.
References contain_agg_clause_walker(), and fb().
Referenced by get_eclass_for_sort_expr(), mark_nullable_by_grouping(), and subquery_planner().
Definition at line 196 of file clauses.c.
References Assert, contain_agg_clause_walker(), expression_tree_walker, fb(), and IsA.
Referenced by contain_agg_clause(), and contain_agg_clause_walker().
Definition at line 1190 of file clauses.c.
References contain_context_dependent_node_walker().
Referenced by inline_function().
Definition at line 1200 of file clauses.c.
References CCDN_CASETESTEXPR_OK, contain_context_dependent_node_walker(), expression_tree_walker, fb(), and IsA.
Referenced by contain_context_dependent_node(), and contain_context_dependent_node_walker().
Definition at line 1148 of file clauses.c.
References contain_exec_param_walker(), and fb().
Referenced by test_opexpr_is_hashable().
Definition at line 1154 of file clauses.c.
References contain_exec_param_walker(), expression_tree_walker, fb(), IsA, list_member_int(), PARAM_EXEC, Param::paramid, and Param::paramkind.
Referenced by contain_exec_param(), and contain_exec_param_walker().
Definition at line 1274 of file clauses.c.
References contain_leaked_vars_walker(), and fb().
Referenced by make_plain_restrictinfo(), and qual_is_pushdown_safe().
Definition at line 1280 of file clauses.c.
References fb(), and get_func_leakproof().
Referenced by contain_leaked_vars_walker().
Definition at line 1286 of file clauses.c.
References check_functions_in_node(), TypeCacheEntry::cmp_proc, contain_leaked_vars_checker(), contain_leaked_vars_walker(), contain_var_clause(), expression_tree_walker, fb(), forthree, get_func_leakproof(), get_opcode(), getSubscriptingRoutines(), lfirst, lfirst_oid, lookup_type_cache(), nodeTag, OidIsValid, SubscriptingRef::refassgnexpr, and TYPECACHE_CMP_PROC.
Referenced by contain_leaked_vars(), and contain_leaked_vars_walker().
Definition at line 379 of file clauses.c.
References contain_mutable_functions_walker(), and fb().
Referenced by can_minmax_aggs(), check_index_predicates(), ComputePartitionAttrs(), contain_mutable_functions_after_planning(), create_bitmap_scan_plan(), create_indexscan_plan(), eval_const_expressions_mutator(), exec_save_simple_expr(), inline_function(), is_foreign_expr(), and relation_excluded_by_constraints().
Definition at line 499 of file clauses.c.
References contain_mutable_functions(), and expression_planner().
Referenced by CheckPredicate(), ComputeIndexAttrs(), and cookDefault().
Definition at line 385 of file clauses.c.
References fb(), and func_volatile().
Referenced by contain_mutable_functions_walker().
Definition at line 391 of file clauses.c.
References Assert, castNode, check_functions_in_node(), contain_mutable_functions_checker(), contain_mutable_functions_walker(), DatumGetJsonPathP(), expression_tree_walker, exprType(), fb(), IsA, JS_FORMAT_JSONB, jspIsMutable(), lfirst, query_tree_walker, to_json_is_immutable(), and to_jsonb_is_immutable().
Referenced by contain_mutable_functions(), and contain_mutable_functions_walker().
Definition at line 3808 of file clauses.c.
References contain_non_const_walker(), expression_tree_walker, fb(), and IsA.
Referenced by contain_non_const_walker().
Definition at line 1002 of file clauses.c.
References contain_nonstrict_functions_walker(), and fb().
Referenced by inline_function(), and pullup_replace_vars_callback().
Definition at line 1008 of file clauses.c.
References fb(), and func_strict().
Referenced by contain_nonstrict_functions_walker().
Definition at line 1014 of file clauses.c.
References AND_EXPR, arg, BoolExpr::boolop, check_functions_in_node(), contain_nonstrict_functions_checker(), contain_nonstrict_functions_walker(), expression_tree_walker, fb(), getSubscriptingRoutines(), IsA, OR_EXPR, and SubscriptingRef::refassgnexpr.
Referenced by contain_nonstrict_functions(), and contain_nonstrict_functions_walker().
Definition at line 339 of file clauses.c.
References contain_subplans_walker(), and fb().
Referenced by convert_EXISTS_to_ANY(), ExecInitValuesScan(), find_simplified_clause(), find_window_run_conditions(), initialize_peragg(), inline_function(), inline_function_in_from(), qual_is_pushdown_safe(), and subquery_planner().
Definition at line 345 of file clauses.c.
References contain_subplans_walker(), expression_tree_walker, fb(), and IsA.
Referenced by contain_subplans(), and contain_subplans_walker().
Definition at line 547 of file clauses.c.
References contain_volatile_functions_walker(), and fb().
Referenced by apply_child_basequals(), ATExecAddColumn(), check_hashjoinable(), check_mergejoinable(), check_output_expressions(), compute_semijoin_info(), contain_volatile_functions_after_planning(), convert_ANY_sublink_to_join(), convert_EXISTS_sublink_to_join(), convert_EXISTS_to_ANY(), convert_VALUES_to_ANY(), CopyFrom(), distribute_qual_to_rels(), estimate_num_groups(), ExecInitWindowAgg(), expand_indexqual_rowcompare(), find_compatible_agg(), find_simplified_clause(), get_eclass_for_sort_expr(), get_memoize_path(), group_similar_or_args(), initialize_peragg(), inline_function(), inline_function_in_from(), is_pseudo_constant_clause(), is_pseudo_constant_clause_relids(), is_pseudo_constant_for_index(), is_safe_restriction_clause_for(), is_simple_subquery(), is_simple_values(), IsBinaryTidClause(), IsTidEqualAnyClause(), make_sort_input_target(), mark_nullable_by_grouping(), match_clause_to_ordering_op(), match_clause_to_partition_key(), match_opclause_to_indexcol(), match_orclause_to_indexcol(), match_rowcompare_to_indexcol(), match_saopclause_to_indexcol(), paraminfo_get_equal_hashops(), qual_is_pushdown_safe(), remove_unused_subquery_outputs(), SS_process_ctes(), and subquery_planner().
Definition at line 668 of file clauses.c.
References contain_volatile_functions(), and expression_planner().
Definition at line 553 of file clauses.c.
References fb(), and func_volatile().
Referenced by contain_volatile_functions_walker().
Definition at line 682 of file clauses.c.
References contain_volatile_functions_not_nextval_walker(), and fb().
Referenced by BeginCopyFrom().
Definition at line 688 of file clauses.c.
References fb(), and func_volatile().
Referenced by contain_volatile_functions_not_nextval_walker().
Definition at line 695 of file clauses.c.
References check_functions_in_node(), contain_volatile_functions_not_nextval_checker(), contain_volatile_functions_not_nextval_walker(), expression_tree_walker, fb(), IsA, and query_tree_walker.
Referenced by contain_volatile_functions_not_nextval(), and contain_volatile_functions_not_nextval_walker().
Definition at line 559 of file clauses.c.
References check_functions_in_node(), RestrictInfo::clause, contain_volatile_functions_checker(), contain_volatile_functions_walker(), expression_tree_walker, PathTarget::exprs, fb(), PathTarget::has_volatile_expr, IsA, query_tree_walker, VOLATILITY_NOVOLATILE, and VOLATILITY_VOLATILE.
Referenced by contain_volatile_functions(), and contain_volatile_functions_walker().
Definition at line 227 of file clauses.c.
References contain_windowfuncs().
Referenced by get_eclass_for_sort_expr(), and mark_nullable_by_grouping().
Definition at line 2300 of file clauses.c.
References convert_saop_to_hashed_saop_walker(), and fb().
Referenced by preprocess_expression().
Definition at line 2306 of file clauses.c.
References ScalarArrayOpExpr::args, ARR_DIMS, ARR_NDIM, ArrayGetNItems(), convert_saop_to_hashed_saop_walker(), DatumGetPointer(), expression_tree_walker, fb(), get_negator(), get_op_hash_functions(), get_opcode(), IsA, lsecond, MIN_ARRAY_SIZE_FOR_HASHED_SAOP, nitems, OidIsValid, ScalarArrayOpExpr::opno, and ScalarArrayOpExpr::useOr.
Referenced by convert_saop_to_hashed_saop(), and convert_saop_to_hashed_saop_walker().
|
static |
Definition at line 3824 of file clauses.c.
References eval_const_expressions_context::estimate, fb(), and func_volatile().
Referenced by eval_const_expressions_mutator().
| Node * estimate_expression_value | ( | PlannerInfo * | root, |
| Node * | node | ||
| ) |
Definition at line 2408 of file clauses.c.
References eval_const_expressions_context::active_fns, eval_const_expressions_context::boundParams, eval_const_expressions_context::case_val, eval_const_expressions_context::estimate, eval_const_expressions_mutator(), fb(), NIL, eval_const_expressions_context::root, and root.
Referenced by array_unnest_support(), bernoulli_samplescangetsamplesize(), clause_selectivity_ext(), generate_series_int4_support(), generate_series_int8_support(), generate_series_numeric_support(), generate_series_timestamp_support(), get_restriction_variable(), gincost_opexpr(), gincost_scalararrayopexpr(), preprocess_limit(), scalararraysel(), system_rows_samplescangetsamplesize(), system_samplescangetsamplesize(), and system_time_samplescangetsamplesize().
| Node * eval_const_expressions | ( | PlannerInfo * | root, |
| Node * | node | ||
| ) |
Definition at line 2267 of file clauses.c.
References eval_const_expressions_context::active_fns, eval_const_expressions_context::boundParams, eval_const_expressions_context::case_val, eval_const_expressions_context::estimate, eval_const_expressions_mutator(), fb(), NIL, eval_const_expressions_context::root, and root.
Referenced by apply_child_basequals(), ATExecAttachPartition(), ConstraintImpliedByRelConstraint(), convert_EXISTS_to_ANY(), convert_VALUES_to_ANY(), DoCopy(), expand_insert_targetlist(), expression_planner(), expression_planner_with_deps(), extended_statistics_update(), fetch_statentries_for_relation(), get_proposed_default_constraint(), get_relation_constraints(), get_relation_info(), get_relation_statistics(), infer_arbiter_indexes(), preprocess_expression(), preprocess_function_rtes(), process_implied_equality(), RelationBuildPartitionKey(), RelationGetIndexExpressions(), RelationGetIndexPredicate(), simplify_EXISTS_query(), and SplitPartitionMoveRows().
|
static |
Definition at line 2453 of file clauses.c.
References WindowFunc::aggfilter, AND_EXPR, applyRelabelType(), arg, CoerceViaIO::arg, ConvertRowtypeExpr::arg, CollateExpr::arg, WindowFunc::args, FuncExpr::args, OpExpr::args, BoolExpr::args, RowExpr::args, Assert, BoolGetDatum(), BoolExpr::boolop, eval_const_expressions_context::boundParams, eval_const_expressions_context::case_val, castNode, check_stack_depth(), COERCE_IMPLICIT_CAST, CollateExpr::collOid, Const::consttype, contain_mutable_functions(), copyObject, datumCopy(), DatumGetBool(), DomainHasConstraints(), ece_all_arguments_const, ece_evaluate_expr, ece_function_is_safe(), ece_generic_processing, elog, ERROR, eval_const_expressions_context::estimate, eval_const_expressions_mutator(), evaluate_expr(), expand_function_arguments(), expr_is_nonnullable(), exprCollation(), expression_tree_mutator, exprType(), exprTypmod(), fb(), FuncExpr::funcid, get_typlenbyval(), getTypeInputInfo(), getTypeOutputInfo(), HeapTupleIsValid, WindowFunc::ignore_nulls, Int32GetDatum(), InvalidAttrNumber, InvalidOid, IS_FALSE, IS_NOT_FALSE, IS_NOT_NULL, IS_NOT_TRUE, IS_NOT_UNKNOWN, IS_NULL, IS_TRUE, IS_UNKNOWN, IsA, lappend(), lfirst, lfirst_node, linitial, list_length(), list_make1, list_make3, list_nth(), Param::location, WindowFunc::location, FuncExpr::location, OpExpr::location, CoerceViaIO::location, CollateExpr::location, make_andclause(), make_orclause(), makeBoolConst(), makeConst(), makeJsonValueExpr(), makeNode, makeNullConst(), makeVar(), negate_clause(), NIL, nodeTag, NOT_EXPR, ParamListInfoData::numParams, ObjectIdGetDatum(), OidIsValid, OpExpr::opno, OR_EXPR, PARAM_EXTERN, PARAM_FLAG_CONST, Param::paramcollid, ParamListInfoData::paramFetch, Param::paramid, Param::paramkind, ParamListInfoData::params, Param::paramtype, Param::paramtypmod, record_plan_type_dependency(), ReleaseSysCache(), CoerceViaIO::resulttype, eval_const_expressions_context::root, rowtype_field_matches(), SearchSysCache1(), set_opfuncid(), set_sa_opfuncid(), simplify_aggref(), simplify_and_arguments(), simplify_boolean_equality(), simplify_function(), simplify_or_arguments(), SQLValueFunction::typmod, WindowFunc::winfnoid, and WindowFunc::winref.
Referenced by estimate_expression_value(), eval_const_expressions(), eval_const_expressions_mutator(), inline_function(), simplify_and_arguments(), simplify_function(), and simplify_or_arguments().
Definition at line 5284 of file clauses.c.
References CreateExecutorState(), datumCopy(), EState::es_query_cxt, ExecEvalExprSwitchContext(), ExecInitExpr(), fb(), fix_opfuncids(), FreeExecutorState(), get_typlenbyval(), GetPerTupleExprContext, makeConst(), MemoryContextSwitchTo(), PG_DETOAST_DATUM_COPY, and PointerGetDatum().
Referenced by eval_const_expressions_mutator(), evaluate_function(), and transformPartitionBoundValue().
|
static |
Definition at line 4737 of file clauses.c.
References arg, COERCE_EXPLICIT_CALL, eval_const_expressions_context::estimate, evaluate_expr(), fb(), GETSTRUCT(), IsA, lfirst, makeNode, and makeNullConst().
Referenced by simplify_function().
| List * expand_function_arguments | ( | List * | args, |
| bool | include_out_arguments, | ||
| Oid | result_type, | ||
| HeapTuple | func_tuple | ||
| ) |
Definition at line 4487 of file clauses.c.
References add_function_defaults(), arg, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_NDIM, Assert, DatumGetArrayTypeP, elog, ERROR, fb(), GETSTRUCT(), IsA, lfirst, list_length(), pronargs, recheck_cast_function_args(), reorder_function_arguments(), and SysCacheGetAttr().
Referenced by eval_const_expressions_mutator(), simplify_function(), and transformCallStmt().
| bool expr_is_nonnullable | ( | PlannerInfo * | root, |
| Expr * | expr, | ||
| bool | use_rel_info | ||
| ) |
Definition at line 4345 of file clauses.c.
References arg, check_stack_depth(), expr_is_nonnullable(), fb(), foreach_ptr, nodeTag, root, and var_is_nonnullable().
Referenced by eval_const_expressions_mutator(), expr_is_nonnullable(), int8inc_support(), restriction_is_always_false(), and restriction_is_always_true().
| double expression_returns_set_rows | ( | PlannerInfo * | root, |
| Node * | clause | ||
| ) |
Definition at line 298 of file clauses.c.
References clamp_row_est(), fb(), FuncExpr::funcid, get_function_rows(), IsA, root, and set_opfuncid().
Referenced by create_set_projection_path(), estimate_num_groups(), and set_function_size_estimates().
Definition at line 4662 of file clauses.c.
References castNode, fb(), pfree(), str, stringToNode(), SysCacheGetAttrNotNull(), and TextDatumGetCString.
Referenced by add_function_defaults(), and reorder_function_arguments().
Definition at line 1989 of file clauses.c.
References NullTest::arg, BooleanTest::arg, BooleanTest::booltesttype, fb(), IS_NULL, IS_UNKNOWN, IsA, NullTest::nulltesttype, and Var::varlevelsup.
Referenced by check_redundant_nullability_qual(), and find_forced_null_vars().
Definition at line 1928 of file clauses.c.
References AND_EXPR, BoolExpr::args, BoolExpr::boolop, fb(), find_forced_null_var(), find_forced_null_vars(), FirstLowInvalidHeapAttributeNumber, IsA, lfirst, mbms_add_member(), mbms_add_members(), NIL, Var::varattno, and Var::varno.
Referenced by find_forced_null_vars(), and reduce_outer_joins_pass2().
Definition at line 1468 of file clauses.c.
References find_nonnullable_rels_walker().
Referenced by make_outerjoininfo(), and reduce_outer_joins_pass2().
Definition at line 1474 of file clauses.c.
References AND_EXPR, ANY_SUBLINK, RelabelType::arg, CoerceViaIO::arg, ArrayCoerceExpr::arg, ConvertRowtypeExpr::arg, CollateExpr::arg, NullTest::arg, BooleanTest::arg, FuncExpr::args, OpExpr::args, ScalarArrayOpExpr::args, BoolExpr::args, bms_add_members(), bms_int_members(), bms_is_empty, bms_join(), bms_make_singleton(), bms_membership(), BMS_SINGLETON, BoolExpr::boolop, BooleanTest::booltesttype, elog, ERROR, fb(), find_nonnullable_rels_walker(), func_strict(), FuncExpr::funcid, IS_FALSE, IS_NOT_NULL, IS_NOT_UNKNOWN, is_strict_saop(), IS_TRUE, IsA, lfirst, NOT_EXPR, NullTest::nulltesttype, OR_EXPR, ROWCOMPARE_SUBLINK, set_opfuncid(), SubPlan::subLinkType, SubPlan::testexpr, Var::varlevelsup, and Var::varno.
Referenced by find_nonnullable_rels(), and find_nonnullable_rels_walker().
Definition at line 1719 of file clauses.c.
References find_nonnullable_vars_walker().
Referenced by reduce_outer_joins_pass2().
Definition at line 1725 of file clauses.c.
References AND_EXPR, ANY_SUBLINK, RelabelType::arg, CoerceViaIO::arg, ArrayCoerceExpr::arg, ConvertRowtypeExpr::arg, CollateExpr::arg, NullTest::arg, BooleanTest::arg, FuncExpr::args, OpExpr::args, ScalarArrayOpExpr::args, BoolExpr::args, BoolExpr::boolop, BooleanTest::booltesttype, elog, ERROR, fb(), find_nonnullable_vars_walker(), FirstLowInvalidHeapAttributeNumber, func_strict(), FuncExpr::funcid, IS_FALSE, IS_NOT_NULL, IS_NOT_UNKNOWN, is_strict_saop(), IS_TRUE, IsA, lfirst, mbms_add_member(), mbms_add_members(), mbms_int_members(), NIL, NOT_EXPR, NullTest::nulltesttype, OR_EXPR, ROWCOMPARE_SUBLINK, set_opfuncid(), SubPlan::subLinkType, SubPlan::testexpr, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by find_nonnullable_vars(), and find_nonnullable_vars_walker().
| WindowFuncLists * find_window_functions | ( | Node * | clause, |
| Index | maxWinRef | ||
| ) |
Definition at line 240 of file clauses.c.
References fb(), find_window_functions_walker(), palloc0(), and palloc_object.
Referenced by grouping_planner().
|
static |
Definition at line 252 of file clauses.c.
References Assert, elog, ERROR, expression_tree_walker, fb(), find_window_functions_walker(), IsA, lappend(), and WindowFunc::winref.
Referenced by find_window_functions(), and find_window_functions_walker().
|
static |
Definition at line 4863 of file clauses.c.
References ACL_EXECUTE, ACLCHECK_OK, eval_const_expressions_context::active_fns, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, arg, castNode, check_sql_fn_retval(), CMD_SELECT, COERCE_EXPLICIT_CALL, contain_context_dependent_node(), contain_mutable_functions(), contain_nonstrict_functions(), contain_subplans(), contain_volatile_functions(), copyObject, cost_qual_eval(), cpu_operator_cost, CurrentMemoryContext, error_context_stack, eval_const_expressions_mutator(), exprCollation(), exprType(), fb(), FmgrHookIsNeeded, free_parsestate(), get_expr_result_type(), GETSTRUCT(), GetUserId(), heap_attisnull(), i, IsA, lappend_oid(), lfirst, linitial, linitial_node, list_delete_last(), list_length(), list_make1, list_member_oid(), make_parsestate(), makeNode, MemoryContextDelete(), MemoryContextSwitchTo(), NameStr, object_aclcheck(), OidIsValid, ParseState::p_sourcetext, palloc0(), pg_parse_query(), prepare_sql_fn_parse_info(), ErrorContextCallback::previous, inline_error_callback_arg::proname, inline_error_callback_arg::prosrc, querytree(), record_plan_function_dependency(), eval_const_expressions_context::root, sql_fn_parser_setup(), sql_inline_error_callback(), stringToNode(), substitute_actual_parameters(), SysCacheGetAttr(), SysCacheGetAttrNotNull(), TextDatumGetCString, and transformTopLevelStmt().
Referenced by simplify_function().
| Query * inline_function_in_from | ( | PlannerInfo * | root, |
| RangeTblEntry * | rte | ||
| ) |
Definition at line 5376 of file clauses.c.
References ACL_EXECUTE, ACLCHECK_OK, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, check_stack_depth(), CMD_SELECT, contain_subplans(), contain_volatile_functions(), copyObject, CurrentMemoryContext, DatumGetPointer(), elog, ERROR, error_context_stack, fb(), FmgrHookIsNeeded, RangeTblFunction::funcexpr, GETSTRUCT(), GetUserId(), heap_attisnull(), HeapTupleIsValid, inline_sql_function_in_from(), IsA, linitial, list_length(), MemoryContextDelete(), MemoryContextSwitchTo(), NameStr, object_aclcheck(), ObjectIdGetDatum(), OidFunctionCall1, PointerGetDatum(), ErrorContextCallback::previous, inline_error_callback_arg::proname, inline_error_callback_arg::prosrc, querytree(), record_plan_function_dependency(), ReleaseSysCache(), root, RTE_FUNCTION, SearchSysCache1(), sql_inline_error_callback(), substitute_actual_parameters_in_from(), SysCacheGetAttrNotNull(), TextDatumGetCString, and SupportRequestInlineInFrom::type.
Referenced by preprocess_function_rtes().
|
static |
Definition at line 5580 of file clauses.c.
References AcquireRewriteLocks(), BuildDescFromLists(), castNode, check_sql_fn_retval(), CMD_SELECT, fb(), get_expr_result_type(), IsA, linitial, linitial_node, list_length(), list_make1, NIL, pg_analyze_and_rewrite_withcb(), pg_parse_query(), pg_rewrite_query(), prepare_sql_fn_parse_info(), querytree(), sql_fn_parser_setup(), stringToNode(), SysCacheGetAttr(), TextDatumGetCString, TYPEFUNC_COMPOSITE, TYPEFUNC_COMPOSITE_DOMAIN, and TYPEFUNC_RECORD.
Referenced by inline_function_in_from().
| bool is_parallel_safe | ( | PlannerInfo * | root, |
| Node * | node | ||
| ) |
Definition at line 762 of file clauses.c.
References fb(), lfirst, list_concat(), max_parallel_hazard_context::max_hazard, max_parallel_hazard_context::max_interesting, max_parallel_hazard_walker(), NIL, root, and max_parallel_hazard_context::safe_param_ids.
Referenced by apply_projection_to_path(), build_join_rel(), create_minmaxagg_path(), create_nestloop_plan(), create_partial_unique_paths(), create_projection_path(), create_set_projection_path(), create_window_paths(), find_computable_ec_member(), grouping_planner(), make_grouping_rel(), plan_create_index_workers(), query_planner(), relation_can_be_sorted_early(), and set_rel_consider_parallel().
Definition at line 2100 of file clauses.c.
References contain_var_clause(), and contain_volatile_functions().
Referenced by clauselist_selectivity_ext(), dependency_is_compatible_clause(), dependency_is_compatible_expression(), and find_window_run_conditions().
Definition at line 2120 of file clauses.c.
References bms_is_empty, and contain_volatile_functions().
Referenced by clauselist_selectivity_ext().
|
static |
Definition at line 2038 of file clauses.c.
References ScalarArrayOpExpr::args, ARR_DIMS, ARR_NDIM, ArrayGetNItems(), Assert, DatumGetArrayTypeP, fb(), func_strict(), IsA, list_length(), lsecond, NIL, nitems, set_sa_opfuncid(), and ScalarArrayOpExpr::useOr.
Referenced by find_nonnullable_rels_walker(), and find_nonnullable_vars_walker().
| ScalarArrayOpExpr * make_SAOP_expr | ( | Oid | oper, |
| Node * | leftexpr, | ||
| Oid | coltype, | ||
| Oid | arraycollid, | ||
| Oid | inputcollid, | ||
| List * | exprs, | ||
| bool | haveNonConst | ||
| ) |
Definition at line 5832 of file clauses.c.
References construct_md_array(), fb(), foreach_node, get_array_type(), get_opcode(), get_typlenbyvalalign(), i, InvalidOid, list_free(), list_length(), list_make2, makeConst(), makeNode, OidIsValid, oper(), palloc_array, pfree(), PointerGetDatum(), typalign, and value.
Referenced by convert_VALUES_to_ANY(), and match_orclause_to_indexcol().
Definition at line 743 of file clauses.c.
References fb(), max_parallel_hazard_context::max_hazard, max_parallel_hazard_context::max_interesting, max_parallel_hazard_walker(), NIL, parse(), and max_parallel_hazard_context::safe_param_ids.
Referenced by standard_planner().
Definition at line 831 of file clauses.c.
References fb(), func_parallel(), and max_parallel_hazard_test().
Referenced by max_parallel_hazard_walker().
|
static |
Definition at line 803 of file clauses.c.
References Assert, elog, ERROR, fb(), max_parallel_hazard_context::max_hazard, and max_parallel_hazard_context::max_interesting.
Referenced by max_parallel_hazard_checker(), and max_parallel_hazard_walker().
|
static |
Definition at line 838 of file clauses.c.
References SubPlan::args, check_functions_in_node(), RestrictInfo::clause, expression_tree_walker, fb(), IsA, list_concat_copy(), list_free(), list_member_int(), max_parallel_hazard_context::max_hazard, max_parallel_hazard_checker(), max_parallel_hazard_test(), max_parallel_hazard_walker(), SubPlan::parallel_safe, PARAM_EXEC, PARAM_EXTERN, Param::paramid, SubPlan::paramIds, Param::paramkind, query_tree_walker, Query::rowMarks, max_parallel_hazard_context::safe_param_ids, and SubPlan::testexpr.
Referenced by is_parallel_safe(), max_parallel_hazard(), and max_parallel_hazard_walker().
| int NumRelids | ( | PlannerInfo * | root, |
| Node * | clause | ||
| ) |
Definition at line 2142 of file clauses.c.
References bms_del_members(), bms_free(), bms_num_members(), pull_varnos(), and root.
Referenced by clauselist_selectivity_ext(), rowcomparesel(), and treat_as_join_clause().
Definition at line 5800 of file clauses.c.
References fb(), and pull_paramids_walker().
Referenced by create_memoize_plan().
Definition at line 5810 of file clauses.c.
References bms_add_member(), expression_tree_walker, fb(), IsA, Param::paramid, and pull_paramids_walker().
Referenced by pull_paramids(), and pull_paramids_walker().
|
static |
Definition at line 4692 of file clauses.c.
References Assert, elog, enforce_generic_type_consistency(), ERROR, exprType(), fb(), FUNC_MAX_ARGS, GETSTRUCT(), lfirst, list_length(), make_fn_arguments(), and pronargs.
Referenced by expand_function_arguments().
Definition at line 4568 of file clauses.c.
References arg, Assert, elog, ERROR, fb(), fetch_function_defaults(), FUNC_MAX_ARGS, GETSTRUCT(), i, IsA, lappend(), lfirst, list_length(), NIL, and pronargs.
Referenced by expand_function_arguments().
|
static |
Definition at line 2198 of file clauses.c.
References fb(), lookup_rowtype_tupdesc_domain(), TupleDescData::natts, ReleaseTupleDesc, and TupleDescAttr().
Referenced by eval_const_expressions_mutator().
|
static |
Definition at line 4237 of file clauses.c.
References Aggref::aggfnoid, Assert, DatumGetPointer(), fb(), get_func_support(), OidFunctionCall1, OidIsValid, PointerGetDatum(), eval_const_expressions_context::root, and Node::type.
Referenced by eval_const_expressions_mutator().
|
static |
Definition at line 3968 of file clauses.c.
References arg, DatumGetBool(), eval_const_expressions_mutator(), fb(), is_andclause(), IsA, lappend(), linitial, list_concat_copy(), list_copy(), list_delete_first(), list_free(), and NIL.
Referenced by eval_const_expressions_mutator().
Definition at line 4062 of file clauses.c.
References Assert, DatumGetBool(), fb(), IsA, linitial, list_length(), lsecond, and negate_clause().
Referenced by eval_const_expressions_mutator().
|
static |
Definition at line 4131 of file clauses.c.
References Assert, COERCE_EXPLICIT_CALL, DatumGetPointer(), elog, ERROR, eval_const_expressions_mutator(), evaluate_function(), expand_function_arguments(), expression_tree_mutator, fb(), GETSTRUCT(), HeapTupleIsValid, inline_function(), ObjectIdGetDatum(), OidFunctionCall1, OidIsValid, PointerGetDatum(), ReleaseSysCache(), eval_const_expressions_context::root, SearchSysCache1(), and FuncExpr::xpr.
Referenced by eval_const_expressions_mutator().
|
static |
Definition at line 3862 of file clauses.c.
References arg, DatumGetBool(), eval_const_expressions_mutator(), fb(), is_orclause(), IsA, lappend(), linitial, list_concat_copy(), list_copy(), list_delete_first(), list_free(), and NIL.
Referenced by eval_const_expressions_mutator().
Definition at line 5260 of file clauses.c.
References arg, errcontext, errposition(), fb(), geterrposition(), internalerrposition(), internalerrquery(), inline_error_callback_arg::proname, and inline_error_callback_arg::prosrc.
Referenced by inline_function(), and inline_function_in_from().
|
static |
Definition at line 5219 of file clauses.c.
References substitute_actual_parameters_context::args, substitute_actual_parameters_context::nargs, substitute_actual_parameters_mutator(), and substitute_actual_parameters_context::usecounts.
Referenced by inline_function().
Definition at line 5740 of file clauses.c.
References substitute_actual_parameters_in_from_context::args, substitute_actual_parameters_in_from_context::nargs, query_tree_mutator, substitute_actual_parameters_in_from_context::sublevels_up, and substitute_actual_parameters_in_from_mutator().
Referenced by inline_function_in_from().
|
static |
Definition at line 5755 of file clauses.c.
References substitute_actual_parameters_in_from_context::args, copyObject, elog, ERROR, expression_tree_mutator, fb(), IncrementVarSublevelsUp(), IsA, list_nth(), substitute_actual_parameters_in_from_context::nargs, PARAM_EXTERN, Param::paramid, Param::paramkind, query_tree_mutator, substitute_actual_parameters_in_from_context::sublevels_up, and substitute_actual_parameters_in_from_mutator().
Referenced by substitute_actual_parameters_in_from(), and substitute_actual_parameters_in_from_mutator().
|
static |
Definition at line 5232 of file clauses.c.
References substitute_actual_parameters_context::args, elog, ERROR, expression_tree_mutator, fb(), IsA, list_nth(), substitute_actual_parameters_context::nargs, PARAM_EXTERN, Param::paramid, Param::paramkind, substitute_actual_parameters_mutator(), and substitute_actual_parameters_context::usecounts.
Referenced by substitute_actual_parameters(), and substitute_actual_parameters_mutator().
| bool var_is_nonnullable | ( | PlannerInfo * | root, |
| Var * | var, | ||
| bool | use_rel_info | ||
| ) |
Definition at line 4280 of file clauses.c.
References Assert, bms_is_empty, bms_is_member(), fb(), find_base_rel(), find_relation_notnullatts(), IsA, RelOptInfo::notnullattnums, planner_rt_fetch, root, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by expr_is_nonnullable().