Re: BUG #15297: Irregular comparison rules for NULLs in tuples

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #15297: Irregular comparison rules for NULLs in tuples
Дата
Msg-id 27390.1532613836@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #15297: Irregular comparison rules for NULLs in tuples  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #15297: Irregular comparison rules for NULLs in tuples  (Raphael 'kena' Poss <knz@thaumogen.net>)
Список pgsql-bugs
=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> The SQL standard mandates ternary logic for values that involve NULL, where
> NULL means "unknown".

Right.

> "select (1, (1, NULL::int)) > (1, (1, 2))"  -> returns true !?

We insist on non-null record values being totally ordered, because without
that you can't build a working btree opclass for them.  So the general
principle for comparing corresponding fields in two records is that nulls
sort after non-nulls and two nulls are treated as equal.  The same goes
for elements in other container types such as arrays.

I don't know whether this behavior can be justified by chapter and verse
in the SQL standard, but it doesn't really matter; we will not change it.

            regards, tom lane


В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #15298: Array-array comparisons when arrays contain NULLs
Следующее
От: Raphael 'kena' Poss
Дата:
Сообщение: Re: BUG #15297: Irregular comparison rules for NULLs in tuples