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

From Tom Lane
Subject pgsql: Fix ruleutils.c's dumping of whole-row Vars in ROW() and VALUES(
Date
Msg-id E1Zy3BK-0006nD-0e@gemulon.postgresql.org
Whole thread Raw
List 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_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/ed824cf80d46ecd5bfd06d4cc65b075328b2db85

Modified Files
--------------
src/backend/utils/adt/ruleutils.c         |   35 ++++++++--
src/test/regress/expected/create_view.out |  105 +++++++++++++++++------------
src/test/regress/sql/create_view.sql      |   15 +++++
3 files changed, 106 insertions(+), 49 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix ruleutils.c's dumping of whole-row Vars in ROW() and VALUES(
Next
From: Tom Lane
Date:
Subject: pgsql: Fix ruleutils.c's dumping of whole-row Vars in ROW() and VALUES(