Re: PostgreSQL does not propagate empty inputs through INTERSECT and EXCEPT

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: 陈列行 <2320415112(at)qq(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: PostgreSQL does not propagate empty inputs through INTERSECT and EXCEPT
Date: 2026-08-17 08:40:41
Message-ID: CAApHDvo82N__TsQ1mtztHWtYcXhK=Bxk=H=kfUxzOeD-Q5HDrg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 17 Aug 2026 at 20:29, 陈列行 <2320415112(at)qq(dot)com> wrote:
> ### Expected behaviour
>
> The planner should replace `A INTERSECT empty` and `empty EXCEPT B` with the
> equivalent empty branch query `SELECT ... FROM A WHERE FALSE`.

A new optimisation was added in 03d40e4b5 to improve this situation.
That change was incorporated into PostgreSQL 19, which is in beta.
Feel free to try it out and provide any feedback that you have.

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Yilin Zhang 2026-08-17 08:36:10 Re: basebackup: do not verify checksums on pages written before enabling checksums