pgsql: Fix ruleutils.c's dumping of whole-row Vars in more contexts.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix ruleutils.c's dumping of whole-row Vars in more contexts.
Date: 2022-01-13 22:50:06
Message-ID: E1n88v0-0004u1-80@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 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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/43c2175121c829c8591fc5117b725f1f22bfb670

Modified Files
--------------
src/backend/utils/adt/ruleutils.c | 56 +++++++++++++++++++------------
src/test/regress/expected/create_view.out | 19 ++++++++++-
src/test/regress/sql/create_view.sql | 5 +++
3 files changed, 57 insertions(+), 23 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2022-01-14 01:49:16 Re: pgsql: Improve error handling of cryptohash computations
Previous Message Tom Lane 2022-01-13 19:52:12 Re: pgsql: Improve error handling of cryptohash computations