Re: BUG #18905: The opposite WHERE clause intersects and is always an empty set. It should perform no action. - Mailing list pgsql-bugs

From 赖锦辉
Subject Re: BUG #18905: The opposite WHERE clause intersects and is always an empty set. It should perform no action.
Date
Msg-id tencent_47C0CAC405AB8FF03DADC3B5ED82151EF506@qq.com
Whole thread Raw
In response to Re: BUG #18905: The opposite WHERE clause intersects and is always an empty set. It should perform no action.  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: BUG #18905: The opposite WHERE clause intersects and is always an empty set. It should perform no action.
List pgsql-bugs

Dear PostgreSQL Development Team,

Thanks for your reply. But I don't believe this optimization is meaningless. Let me illustrate with two examples:

Example 1: Users inevitably make mistakes when writing SQL, such as accidentally writing WHERE a1=2 instead of WHERE 1=2.
Example 2: Some automated testing tools may randomly generate similar cases.

If PostgreSQL can optimize for such scenarios, it would save users significant time and effort. Similar issues have been found in MySQL and MariaDB, where they have been acknowledged and addressed — in fact, MariaDB has already fixed such problems.

As a loyal PostgreSQL user, I sincerely hope these issues can be addressed to make PostgreSQL even better.


Best regards,



原始邮件

发件人:David G. Johnston <david.g.johnston@gmail.com>
发件时间:2025年4月28日 01:34
收件人:jh.lai@qq.com <jh.lai@qq.com>, pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
主题:Re: BUG #18905: The opposite WHERE clause intersects and is always anempty set. It should perform no action.

On Sunday, April 27, 2025, PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      18905
Logged by:          jinhui lai
Email address:      jh.lai@qq.com
PostgreSQL version: 17.4
Operating system:   ubuntu 22.04
Description:        

As with 18904, this is not a bug.

David J.


pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #18906: EXCEPT with identical left/right queries isn't eliminated
Next
From: Tom Lane
Date:
Subject: Re: BUG #18904: INTERSECT with an impossible where should eliminate both from the query plan