Re: IS NOT DISTINCT FROM statement

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Artur Zając <azajac(at)ang(dot)com(dot)pl>, pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: IS NOT DISTINCT FROM statement
Date: 2019-03-08 11:45:39
Message-ID: 9d4c7b0de250db9aef716600ca6e39652738ff4e.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Artur Zając wrote:
> Is there any reason that „NOT DISTINCT FROM” can’t be autotransformed to „=” when value
> on right side of expression is not NULL or is this any way to use index with „IS NOT DISTINCT FROM” statement?

That would subtly change the semantics of the expression:

test=> SELECT NULL IS NOT DISTINCT FROM 21580;
?column?
----------
f
(1 row)

test=> SELECT NULL = 21580;
?column?
----------

(1 row)

One expression is FALSE, the other NULL.

It doesn't matter in the context of your specific query, but it could matter.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message David Rowley 2019-03-08 12:13:49 Re: IS NOT DISTINCT FROM statement
Previous Message Artur Zając 2019-03-08 11:30:41 IS NOT DISTINCT FROM statement