Re: Wrong result for comparing ROW(...) with IS NOT NULL
От | Pavel Borisov |
---|---|
Тема | Re: Wrong result for comparing ROW(...) with IS NOT NULL |
Дата | |
Msg-id | CALT9ZEEN9x-OoFqixs-Gs9XXhJ3uUJzMerEJ-d3Lo4geWFzAMw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Wrong result for comparing ROW(...) with IS NOT NULL (Wolfgang Walther <walther@technowledgy.de>) |
Ответы |
Re: Wrong result for comparing ROW(...) with IS NOT NULL
|
Список | 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."В списке pgsql-bugs по дате отправления: