Fix ruleutils.c's dumping of whole-row Vars in ROW() and VALUES() contexts.
authorTom Lane
Sun, 15 Nov 2015 19:41:09 +0000 (14:41 -0500)
committerTom Lane
Sun, 15 Nov 2015 19:41:09 +0000 (14:41 -0500)
commit7d0e8720865321fcf124eaac6ef22ef22d13b957
tree3d0e36b249970d691ed772511e7300e0ff66a0df
parenta37ab812c7a2a99917e01f07ac4958712ea02637
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.
src/backend/utils/adt/ruleutils.c
src/test/regress/expected/create_view.out
src/test/regress/sql/create_view.sql