From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David Rowley <dgrowleyml@gmail.com>
Cc: pavelsivash@gmail.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #16585: Wrong filtering on a COALESCE field after using GROUPING SETS
Date: Thu, 20 Aug 2020 22:51:32 +0100
Message-ID: <87tuwxrnzm.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <1750212.1597958727@sss.pgh.pa.us>
References: <16585-9d8c340d23ade8c1@postgresql.org>
<CAApHDvoP02UYOS5H82GfDvF_3X9CvWdbseqq-rjufE3GEYRPPA@mail.gmail.com>
<87mu2qixx5.fsf@news-spur.riddles.org.uk>
<1750212.1597958727@sss.pgh.pa.us>
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
Tom> As a stopgap measure, I think what we have to do is teach
Tom> check_output_expressions that subquery output columns are unsafe
Tom> to reference if they are not listed in all grouping sets (do I
Tom> have that condition right?).
Unless I'm missing something, it should be safe to reference output
columns that are not mentioned in any grouping set, or which are
mentioned in all grouping sets (after all expansions); but unsafe to
reference columns mentioned in some grouping sets but not others (since
these will be forced to null in the output for the sets in which they
don't appear).
--
Andrew (irc:RhodiumToad)
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: andrew@tao11.riddles.org.uk, tgl@sss.pgh.pa.us, dgrowleyml@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16585: Wrong filtering on a COALESCE field after using GROUPING SETS
In-Reply-To: <87tuwxrnzm.fsf@news-spur.riddles.org.uk>
* 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