pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Artur Zając <azajac@ang.com.pl>
To: pgsql-performance@lists.postgresql.org
Subject: Re: IS NOT DISTINCT FROM statement
Date: Fri, 08 Mar 2019 12:45:39 +0100
Message-ID: <9d4c7b0de250db9aef716600ca6e39652738ff4e.camel@cybertec.at> (raw)
In-Reply-To: <012a01d4d5a2$5cde0760$169a1620$@ang.com.pl>
References: <012a01d4d5a2$5cde0760$169a1620$@ang.com.pl>

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





view thread (6+ messages)  latest in thread

Message-ID: <9d4c7b0de250db9aef716600ca6e39652738ff4e.camel@cybertec.at>
Permalink:  ../9d4c7b0de250db9aef716600ca6e39652738ff4e.camel@cybertec.at/
Also on:    postgresql.org/message-id/9d4c7b0de250db9aef716600ca6e39652738ff4e.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: laurenz.albe@cybertec.at, azajac@ang.com.pl, pgsql-performance@lists.postgresql.org
  Subject: Re: IS NOT DISTINCT FROM statement
  In-Reply-To: <9d4c7b0de250db9aef716600ca6e39652738ff4e.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox