Re: BUG #18442: Unnecessary Sort operator in indexScan Plan - Mailing list pgsql-bugs

From David Rowley
Subject Re: BUG #18442: Unnecessary Sort operator in indexScan Plan
Date
Msg-id CAApHDvpMwFHTnBLC9zWz9U2Sg61dO6NdjWrf0jvwDHTKv-rudg@mail.gmail.com
Whole thread Raw
In response to Re: BUG #18442: Unnecessary Sort operator in indexScan Plan  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #18442: Unnecessary Sort operator in indexScan Plan
Re: BUG #18442: Unnecessary Sort operator in indexScan Plan
List pgsql-bugs
On Sat, 20 Apr 2024 at 02:03, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> One example is that given
> "a IS NULL" and "a = b", the EquivalenceClass machinery would
> think it can discard "a = b" and instead emit "b IS NULL",
> which would not give the same answers.

While this is relatively fresh, for the sake of the archives...

Presumably, if a=b is strict then effectively nothing could match as
the strict qual ensures NULLs never match and the IS NULL only allows
NULLs.

Couldn't strict equality conditions be handled using the same method
that we use to handle an Eclass with two distinct Consts. e.g a = 1
and a=b and b=2?

If the equality condition isn't strict then won't "b" be NULL if "a" is?

David



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18443: jsonb_agg issue. Again.
Next
From: Tom Lane
Date:
Subject: Re: BUG #18442: Unnecessary Sort operator in indexScan Plan