Fix ruleutils.c's dumping of whole-row Vars in more contexts.
authorTom Lane
Thu, 13 Jan 2022 22:49:26 +0000 (17:49 -0500)
committerTom Lane
Thu, 13 Jan 2022 22:49:26 +0000 (17:49 -0500)
commit4aee39ddb8fa748a6beea2bc1b48882990c226a7
treed03d454fa1f5ae70557d5bd865c74b6d0b1cfddd
parent3c1ffd02dd058666ddf27d7e621ab5bbc4b769bb
Fix ruleutils.c's dumping of whole-row Vars in more contexts.

Commit 7745bc352 intended to ensure that whole-row Vars would be
printed with "::type" decoration in all contexts where plain
"var.*" notation would result in star-expansion, notably in
ROW() and VALUES() constructs.  However, it missed the case of
INSERT with a single-row VALUES, as reported by Timur Khanjanov.

Nosing around ruleutils.c, I found a second oversight: the
code for RowCompareExpr generates ROW() notation without benefit
of an actual RowExpr, and naturally it wasn't in sync :-(.
(The code for FieldStore also does this, but we don't expect that
to generate strictly parsable SQL anyway, so I left it alone.)

Back-patch to all supported branches.

Discussion: https://postgr.es/m/efaba6f9-4190-56be-8ff2-7a1674f9194f@intrans.baku.az
src/backend/utils/adt/ruleutils.c
src/test/regress/expected/create_view.out
src/test/regress/sql/create_view.sql