From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Make pull_var_clause() handle GroupingFuncs exactly like Aggrefs
Date: Thu, 12 May 2022 15:32:10 +0000
Message-ID: <E1npAnS-000MUH-0D@gemulon.postgresql.org> (raw)
Make pull_var_clause() handle GroupingFuncs exactly like Aggrefs.
This follows in the footsteps of commit 2591ee8ec by removing one more
ill-advised shortcut from planning of GroupingFuncs. It's true that
we don't intend to execute the argument expression(s) at runtime, but
we still have to process any Vars appearing within them, or we risk
failure at setrefs.c time (or more fundamentally, in EXPLAIN trying
to print such an expression). Vars in upper plan nodes have to have
referents in the next plan level, whether we ever execute 'em or not.
Per bug #17479 from Michael J. Sullivan. Back-patch to all supported
branches.
Richard Guo
Discussion: https://postgr.es/m/17479-6260deceaf0ad304@postgresql.org
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/b53442f6fe0f82cc7c2d1e7b15d52da79e6db295
Modified Files
--------------
src/backend/optimizer/util/var.c | 10 +----
src/test/regress/expected/groupingsets.out | 64 ++++++++++++++++++++++++++++++
src/test/regress/sql/groupingsets.sql | 23 +++++++++++
3 files changed, 89 insertions(+), 8 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Make pull_var_clause() handle GroupingFuncs exactly like Aggrefs
In-Reply-To: <E1npAnS-000MUH-0D@gemulon.postgresql.org>
References: <E1npAnS-000MUH-0D@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox