postgresql/src/include/optimizer
Tom Lane 2f153ddfdd Refactor to reduce code duplication for function property checking.
As noted by Andres Freund, we'd accumulated quite a few similar functions
in clauses.c that examine all functions in an expression tree to see if
they satisfy some boolean test.  Reduce the duplication by inventing a
function check_functions_in_node() that applies a simple callback function
to each SQL function OID appearing in a given expression node.  This also
fixes some arguable oversights; for example, contain_mutable_functions()
did not check aggregate or window functions for mutability.  I doubt that
that represents a live bug at the moment, because we don't really consider
mutability for aggregates; but it might someday be one.

I chose to put check_functions_in_node() in nodeFuncs.c because it seemed
like other modules might wish to use it in future.  That in turn forced
moving set_opfuncid() et al into nodeFuncs.c, as the alternative was for
nodeFuncs.c to depend on optimizer/setrefs.c which didn't seem very clean.

In passing, teach contain_leaked_vars_walker() about a few more expression
node types it can safely look through, and improve the rather messy and
undercommented code in has_parallel_hazard_walker().

Discussion: <20160527185853.ziol2os2zskahl7v@alap3.anarazel.de>
2016-06-10 16:03:46 -04:00
..
clauses.h pgindent run for 9.6 2016-06-09 18:02:36 -04:00
cost.h Eliminate "parallel degree" terminology. 2016-06-09 10:00:26 -04:00
geqo.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
geqo_copy.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
geqo_gene.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
geqo_misc.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
geqo_mutation.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
geqo_pool.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
geqo_random.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
geqo_recombination.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
geqo_selection.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
joininfo.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
orclauses.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
pathnode.h Eliminate "parallel degree" terminology. 2016-06-09 10:00:26 -04:00
paths.h Revert "Use Foreign Key relationships to infer multi-column join selectivity". 2016-06-07 17:21:17 -04:00
placeholder.h Add an explicit representation of the output targetlist to Paths. 2016-02-18 20:02:03 -05:00
plancat.h Directly modify foreign tables. 2016-03-18 13:55:52 -04:00
planmain.h Refactor to reduce code duplication for function property checking. 2016-06-10 16:03:46 -04:00
planner.h Redefine create_upper_paths_hook as being invoked once per upper relation. 2016-04-12 15:23:14 -04:00
predtest.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
prep.h Make the upper part of the planner work by generating and comparing Paths. 2016-03-07 15:58:22 -05:00
restrictinfo.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
subselect.h Make the upper part of the planner work by generating and comparing Paths. 2016-03-07 15:58:22 -05:00
tlist.h Support parallel aggregation. 2016-03-21 09:30:18 -04:00
var.h Give pull_var_clause() reject/recurse/return behavior for WindowFuncs too. 2016-03-10 16:23:52 -05:00