pgsql: Make some small planner API cleanups.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make some small planner API cleanups.
Date: 2019-01-29 20:49:03
Message-ID: E1goaJb-0002ms-JN@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make some small planner API cleanups.

Move a few very simple node-creation and node-type-testing functions
from the planner's clauses.c to nodes/makefuncs and nodes/nodeFuncs.
There's nothing planner-specific about them, as evidenced by the
number of other places that were using them.

While at it, rename and_clause() etc to is_andclause() etc, to clarify
that they are node-type-testing functions not node-creation functions.
And use "static inline" implementations for the shortest ones.

Also, modify flatten_join_alias_vars() and some subsidiary functions
to take a Query not a PlannerInfo to define the join structure that
Vars should be translated according to. They were only using the
"parse" field of the PlannerInfo anyway, so this just requires removing
one level of indirection. The advantage is that now parse_agg.c can
use flatten_join_alias_vars() without the horrid kluge of creating an
incomplete PlannerInfo, which will allow that file to be decoupled from
relation.h in a subsequent patch.

Discussion: https://postgr.es/m/11460.1548706639@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a1b8c41e990ec0f083e9b684700a07640d5a356a

Modified Files
--------------
src/backend/commands/explain.c | 1 +
src/backend/executor/nodeSubplan.c | 4 +-
src/backend/executor/nodeTidscan.c | 2 +-
src/backend/nodes/makefuncs.c | 135 ++++++++++++++
src/backend/nodes/print.c | 3 +-
src/backend/optimizer/path/clausesel.c | 7 +-
src/backend/optimizer/path/costsize.c | 1 +
src/backend/optimizer/path/indxpath.c | 6 +-
src/backend/optimizer/path/joinrels.c | 4 +-
src/backend/optimizer/path/tidpath.c | 2 +-
src/backend/optimizer/plan/initsplan.c | 1 +
src/backend/optimizer/plan/planner.c | 5 +-
src/backend/optimizer/plan/subselect.c | 10 +-
src/backend/optimizer/prep/prepjointree.c | 10 +-
src/backend/optimizer/prep/prepqual.c | 15 +-
src/backend/optimizer/util/clauses.c | 246 +------------------------
src/backend/optimizer/util/orclauses.c | 8 +-
src/backend/optimizer/util/predtest.c | 5 +-
src/backend/optimizer/util/restrictinfo.c | 10 +-
src/backend/optimizer/util/var.c | 22 +--
src/backend/parser/parse_agg.c | 36 ++--
src/backend/partitioning/partprune.c | 6 +-
src/backend/statistics/dependencies.c | 3 +-
src/backend/utils/cache/relcache.c | 1 +
src/include/nodes/makefuncs.h | 12 ++
src/include/nodes/nodeFuncs.h | 72 ++++++++
src/include/optimizer/clauses.h | 22 ---
src/include/optimizer/prep.h | 2 +-
src/include/optimizer/var.h | 2 +-
src/test/modules/test_predtest/test_predtest.c | 1 +
30 files changed, 309 insertions(+), 345 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2019-01-29 21:49:32 pgsql: Rename nodes/relation.h to nodes/pathnodes.h.
Previous Message Christoph Berg 2019-01-29 15:55:29 Re: pgsql: Build src/port files as a library with -fPIC, and use that in li