pgsql: Fix dumping of views that are just VALUES(...) but have column a

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix dumping of views that are just VALUES(...) but have column a
Date: 2015-02-25 17:01:40
Message-ID: E1YQfLA-0005NG-Uw@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix dumping of views that are just VALUES(...) but have column aliases.

The "simple" path for printing VALUES clauses doesn't work if we need
to attach nondefault column aliases, because there's noplace to do that
in the minimal VALUES() syntax. So modify get_simple_values_rte() to
detect nondefault aliases and treat that as a non-simple case. This
further exposes that the "non-simple" path never actually worked;
it didn't produce valid syntax. Fix that too. Per bug #12789 from
Curtis McEnroe, and analysis by Andrew Gierth.

Back-patch to all supported branches. Before 9.3, this also requires
back-patching the part of commit 092d7ded29f36b0539046b23b81b9f0bf2d637f1
that created get_simple_values_rte() to begin with; inserting the extra
test into the old factorization of that logic would've been too messy.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/7a501bcbfc64d9e66fa6e83ed57b1804203da3e3

Modified Files
--------------
src/backend/utils/adt/ruleutils.c | 90 +++++++++++++++++++++++++++++------
src/test/regress/expected/rules.out | 51 ++++++++++++++++++++
src/test/regress/sql/rules.sql | 18 +++++++
3 files changed, 144 insertions(+), 15 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-02-25 19:19:19 pgsql: Fix over-optimistic caching in fetch_array_arg_replace_nulls().
Previous Message Michael Meskes 2015-02-25 11:16:33 pgsql: Remove null-pointer checks that are not needed.