agora inbox for pgsql-bugs@postgresql.org
help / color / mirror / Atom feedFrom: Tom Lane <tgl@sss.pgh.pa.us>
To: feasiblechart@gmail.com
Cc: David Rowley <dgrowleyml@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19742: `INTERSECT` under a `UNION ALL` with an empty arm fails with "could not find pathkey item t"
Date: Sat, 03 Oct 2026 17:53:48 -0400
Message-ID: <261146.1791064428@sss.pgh.pa.us> (raw)
In-Reply-To: <19742-dc403ca277cad1d3@postgresql.org>
References: <19742-dc403ca277cad1d3@postgresql.org>
PG Bug reporting form <noreply@postgresql.org> writes:
> Please see the repro. Seems like a regression; 19beta4 and the current main
> branch both have this error raised, but 18.6 works fine. I ran it with psql
> CREATE TABLE d (a int);
> INSERT INTO d VALUES (1), (1), (2), (NULL), (3);
> SELECT * FROM (SELECT a FROM d INTERSECT ALL SELECT a FROM d
> UNION ALL SELECT a FROM d WHERE false) s
> WHERE a = 1;
> -- ERROR: XX000: could not find pathkey item to sort
Bisecting shows this started with
fdda78e361f136ec2b8de579b366c1e66bba1199 is the first bad commit
commit fdda78e361f136ec2b8de579b366c1e66bba1199
Author: David Rowley <drowley@postgresql.org>
Date: Wed Nov 5 11:48:09 2025 +1300
Fix possible usage of incorrect UPPERREL_SETOP RelOptInfo
03d40e4b5 allowed dummy UNION [ALL] children to be removed from the plan
by checking for is_dummy_rel(). That commit neglected to still account
for the relids from the dummy rel so that the correct UPPERREL_SETOP
RelOptInfo could be found and used for adding the Paths to.
I suspect that that commit just allowed reaching some pre-existing
mistake, but I've not dug into it.
regards, tom lane
view thread (6+ messages) latest in thread
Message-ID: <261146.1791064428@sss.pgh.pa.us>
Permalink: ../261146.1791064428@sss.pgh.pa.us/
Also on: postgresql.org/message-id/261146.1791064428@sss.pgh.pa.us
reply
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: tgl@sss.pgh.pa.us, feasiblechart@gmail.com, dgrowleyml@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19742: `INTERSECT` under a `UNION ALL` with an empty arm fails with "could not find pathkey item t"
In-Reply-To: <261146.1791064428@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox