pgsql: Refactor pull_var_clause's API to make it less tedious to extend

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Refactor pull_var_clause's API to make it less tedious to extend
Date: 2016-03-10 20:53:27
Message-ID: E1ae7aJ-0001MB-6b@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Refactor pull_var_clause's API to make it less tedious to extend.

In commit 1d97c19a0f748e94 and later c1d9579dd8bf3c92, we extended
pull_var_clause's API by adding enum-type arguments. That's sort of a pain
to maintain, though, because it means every time we add a new behavior we
must touch every last one of the call sites, even if there's a reasonable
default behavior that most of them could use. Let's switch over to using a
bitmask of flags, instead; that seems more maintainable and might save a
nanosecond or two as well. This commit changes no behavior in itself,
though I'm going to follow it up with one that does add a new behavior.

In passing, remove flatten_tlist(), which has not been used since 9.1
and would otherwise need the same API changes.

Removing these enums means that optimizer/tlist.h no longer needs to
depend on optimizer/var.h. Changing that caused a number of C files to
need addition of #include "optimizer/var.h" (probably we can thank old
runs of pgrminclude for that); but on balance it seems like a good change
anyway.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/364a9f47ab363250f62dd2c381c4da435283725a

Modified Files
--------------
contrib/postgres_fdw/deparse.c | 1 -
src/backend/catalog/heap.c | 8 +--
src/backend/commands/trigger.c | 4 +-
src/backend/optimizer/path/allpaths.c | 4 +-
src/backend/optimizer/path/equivclass.c | 2 +-
src/backend/optimizer/plan/analyzejoins.c | 1 +
src/backend/optimizer/plan/createplan.c | 2 +-
src/backend/optimizer/plan/initsplan.c | 6 +-
src/backend/optimizer/plan/planner.c | 5 +-
src/backend/optimizer/plan/setrefs.c | 15 +++--
src/backend/optimizer/prep/prepjointree.c | 1 +
src/backend/optimizer/prep/preptlist.c | 3 +-
src/backend/optimizer/util/placeholder.c | 4 +-
src/backend/optimizer/util/tlist.c | 28 --------
src/backend/optimizer/util/var.c | 108 ++++++++++++++++--------------
src/backend/parser/parse_agg.c | 1 +
src/backend/parser/parse_clause.c | 1 +
src/backend/utils/adt/selfuncs.c | 2 +-
src/include/optimizer/tlist.h | 4 +-
src/include/optimizer/var.h | 22 +++---
20 files changed, 94 insertions(+), 128 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2016-03-10 21:16:37 pgsql: Don't vacuum all-frozen pages.
Previous Message Pavel Stehule 2016-03-10 20:44:33 Re: pgsql: Provide much better wait information in pg_stat_activity.