Re: Wrong result for comparing ROW(...) with IS NOT NULL - Mailing list pgsql-bugs

From Pavel Borisov
Subject Re: Wrong result for comparing ROW(...) with IS NOT NULL
Date
Msg-id CALT9ZEEN9x-OoFqixs-Gs9XXhJ3uUJzMerEJ-d3Lo4geWFzAMw@mail.gmail.com
Whole thread Raw
In response to Re: Wrong result for comparing ROW(...) with IS NOT NULL  (Wolfgang Walther <walther@technowledgy.de>)
Responses Re: Wrong result for comparing ROW(...) with IS NOT NULL
List pgsql-bugs
Ok, I can see how this explanation is somehow consistent. The link you
gave is just another observation of that, though. Can I infer from
anywhere in the official docs, that this is correct and expected behaviour?

Sure, it is described here: https://www.postgresql.org/docs/13/functions-comparison.html

"If the expression is row-valued, then IS NULL is true when the row expression itself is null or when all the row's fields are null, while IS NOT NULL is true when the row expression itself is non-null and all the row's fields are non-null. Because of this behavior, IS NULL and IS NOT NULL do not always return inverse results for row-valued expressions; in particular, a row-valued expression that contains both null and non-null fields will return false for both tests. In some cases, it may be preferable to write row IS DISTINCT FROM NULL or row IS NOT DISTINCT FROM NULL, which will simply check whether the overall row value is null without any additional tests on the row fields."


--
Best regards,
Pavel Borisov

Postgres Professional: http://postgrespro.com

pgsql-bugs by date:

Previous
From: Wolfgang Walther
Date:
Subject: Re: Wrong result for comparing ROW(...) with IS NOT NULL
Next
From: Wolfgang Walther
Date:
Subject: Re: Wrong result for comparing ROW(...) with IS NOT NULL