Re: (record = record) inconsistent with record_eq(arg1, arg2)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: (record = record) inconsistent with record_eq(arg1, arg2)
Дата
Msg-id 2947561.1690834024@sss.pgh.pa.us
обсуждение исходный текст
Ответ на (record = record) inconsistent with record_eq(arg1, arg2)  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Monday, July 31, 2023, jian he <jian.universality@gmail.com> wrote:
>> select row(1,null::int) = (1,1::int); -- return null
>> select record_eq(row(1,null::int),(1,1::int)); --return false.

> This isn’t a bug though I can’t point to the exact code where the
> difference manifests.

Yeah, the difference in behavior is deliberate.  See

https://www.postgresql.org/docs/current/functions-comparisons.html#ROW-WISE-COMPARISON

which documents the behavior of ROW(...) = ROW(...), and

https://www.postgresql.org/docs/current/functions-comparisons.html#COMPOSITE-TYPE-COMPARISON

which documents the behavior of record comparisons that are written
in other ways, and explains the reason for the difference.  The
SQL standard governs the behavior of "ROW(...) = ROW(...)", but last
I looked they don't really have a notion of composite-valued scalars,
so the spec has nothing to say about what "row-valued-expression =
row-valued-expression" should do.  Even if it did, we would not
change this, because it's too important to have a total ordering
for composite columns.

            regards, tom lane



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

Предыдущее
От: Kong Man
Дата:
Сообщение: Re: pg_restore 14 skips ACL COLUMN when --schema is used
Следующее
От: Kong Man
Дата:
Сообщение: Re: pg_restore 14 skips ACL COLUMN when --schema is used