Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs
Date: 2025-11-05 04:00:00
Message-ID: cfbc99e5-9d44-4806-ba3c-f36b57a85e21@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello David!

05.11.2025 00:55, David Rowley wrote:
> I finally decided that it was a bit too obscure a scenario to test to
> verify that the same silly mistake didn't reappear.
>
> Thanks again for the report and the simple recreation steps.

Thank you for the fix!

But while playing around, I've just discovered another interesting error:

SET enable_seqscan = 'off';
SELECT * FROM t EXCEPT SELECT * FROM t
UNION SELECT * FROM pt;

leads to:
ERROR:  XX000: no relation entry for relid 0
LOCATION:  find_base_rel, relnode.c:541

Best regards,
Alexander

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2025-11-05 04:33:52 Re: [PATCH] Add archive_mode=follow_primary to prevent unarchived WAL on standby promotion
Previous Message Richard Guo 2025-11-05 03:47:37 Re: Fix comments for ChangeVarNodes() and related functions