Re: BUG #18442: Unnecessary Sort operator in indexScan Plan

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: hu_yajun(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18442: Unnecessary Sort operator in indexScan Plan
Date: 2024-04-22 01:53:02
Message-ID: CAApHDvpMwFHTnBLC9zWz9U2Sg61dO6NdjWrf0jvwDHTKv-rudg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, 20 Apr 2024 at 02:03, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-04-22 02:25:42 Re: BUG #18442: Unnecessary Sort operator in indexScan Plan
Previous Message Tom Lane 2024-04-19 17:52:23 Re: BUG #18443: jsonb_agg issue. Again.