From: Alexander Lakhin <exclusion@gmail.com>
To: David Rowley <dgrowleyml@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs
Date: Tue, 4 Nov 2025 10:00:00 +0200
Message-ID: <bee34aec-659c-46f1-9ab7-7bbae0b7616c@gmail.com> (raw)
In-Reply-To: <CAApHDvrUASy9sfULMEsM2udvZJP6AoBRCZvHYXYxZTy2tX9FYw@mail.gmail.com>
References: <CAApHDvri53PPF76c3M94_QNWbJfXjyCnjXuj_2=LYM-0m8WZtw@mail.gmail.com>
<976130.1759375308@sss.pgh.pa.us>
<CAApHDvpk88w3MrzgZShROjQw3NPK54YKr_hOi0++0QKGwTq+-g@mail.gmail.com>
<1064547.1759418336@sss.pgh.pa.us>
<CAApHDvpVYC43mi8atZ2Q39emK45xh7AaXetMJE9gJyV6sge_mg@mail.gmail.com>
<1196118.1759438964@sss.pgh.pa.us>
<CAApHDvrUASy9sfULMEsM2udvZJP6AoBRCZvHYXYxZTy2tX9FYw@mail.gmail.com>
Hello David,
04.10.2025 06:55, David Rowley wrote:
> On Fri, 3 Oct 2025 at 10:02, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> David Rowley <dgrowleyml@gmail.com> writes:
>>> An alternative way would be to propagate those during build_setop_child_paths()
>> That answer works for me. I was expecting you to just document the
>> need for the extra check in is_dummy_rel ;-) ... but this way is
>> perhaps better.
> So, I pushed the UNION portion earlier, but on hacking more on the
> EXCEPT/INTERSECT patch, I noticed that I don't have the target lists
> correct when marking the top-level set op as dummy. ...
Please look at a new anomaly, introduced with 03d40e4b5:
CREATE TABLE t(i integer);
CREATE TABLE pt(i integer) PARTITION BY LIST(i);
SET enable_seqscan = 'off';
SELECT * FROM t UNION SELECT * FROM t
UNION ALL
SELECT * FROM pt;
produces:
ERROR: XX000: unrecognized node type: 0
LOCATION: create_plan_recurse, createplan.c:538
Best regards.
Alexander
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-hackers@postgresql.org
Cc: exclusion@gmail.com, dgrowleyml@gmail.com, tgl@sss.pgh.pa.us
Subject: Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs
In-Reply-To: <bee34aec-659c-46f1-9ab7-7bbae0b7616c@gmail.com>
References: <CAApHDvri53PPF76c3M94_QNWbJfXjyCnjXuj_2=LYM-0m8WZtw@mail.gmail.com> <976130.1759375308@sss.pgh.pa.us> <CAApHDvpk88w3MrzgZShROjQw3NPK54YKr_hOi0++0QKGwTq+-g@mail.gmail.com> <1064547.1759418336@sss.pgh.pa.us> <CAApHDvpVYC43mi8atZ2Q39emK45xh7AaXetMJE9gJyV6sge_mg@mail.gmail.com> <1196118.1759438964@sss.pgh.pa.us> <CAApHDvrUASy9sfULMEsM2udvZJP6AoBRCZvHYXYxZTy2tX9FYw@mail.gmail.com> <bee34aec-659c-46f1-9ab7-7bbae0b7616c@gmail.com>
* 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