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

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Alexander Lakhin <exclusion(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-04 10:00:09
Message-ID: CAApHDvpM7uggy7o1aj+iiMHdfFa17ufnWyZGK25aK6p1Kp0B7w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 4 Nov 2025 at 22:54, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> The reason we end up with the same result_rel is that we're not
> passing all the relids in fetch_upper_rel(root, UPPERREL_SETOP,
> relids) due to having removed dummy rels. I guess the fix might be
> something like record the relids even when skipping dummy relations.
> I'll go and explore that as an option.

This seems to fix it. I'll study it more in the morning (it's late in
my time zone).

David

Attachment Content-Type Size
minimal_fix.patch application/octet-stream 909 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2025-11-04 10:02:18 Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs
Previous Message Álvaro Herrera 2025-11-04 09:59:27 Re: pg_createsubscriber --dry-run logging concerns