pgsql: Fix ruleutils.c's dumping of whole-row Vars in ROW() and VALUES(

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix ruleutils.c's dumping of whole-row Vars in ROW() and VALUES(
Date: 2015-11-15 19:41:45
Message-ID: E1Zy3BJ-0006n5-WB@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix ruleutils.c's dumping of whole-row Vars in ROW() and VALUES() contexts.

Normally ruleutils prints a whole-row Var as "foo.*". We already knew that
that doesn't work at top level of a SELECT list, because the parser would
treat the "*" as a directive to expand the reference into separate columns,
not a whole-row Var. However, Joshua Yanovski points out in bug #13776
that the same thing happens at top level of a ROW() construct; and some
nosing around in the parser shows that the same is true in VALUES().
Hence, apply the same workaround already devised for the SELECT-list case,
namely to add a forced cast to the appropriate rowtype in these cases.
(The alternative of just printing "foo" was rejected because it is
difficult to avoid ambiguity against plain columns named "foo".)

Back-patch to all supported branches.

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/0489a048d3914e4d5f89c91ac604350b9392e6fa

Modified Files
--------------
src/backend/utils/adt/ruleutils.c | 35 +++++++++--
src/test/regress/expected/create_view.out | 91 +++++++++++++++++++++++++++++
src/test/regress/sql/create_view.sql | 18 ++++++
3 files changed, 139 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-11-15 19:41:46 pgsql: Fix ruleutils.c's dumping of whole-row Vars in ROW() and VALUES(
Previous Message Tom Lane 2015-11-14 19:56:02 pgsql: Improve type numeric's calculations for ln(), log(), exp(), pow(