Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really?

Поиск
Список
Период
Сортировка
Искать
От
Thomas Kellerer
Тема
Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really?
Дата
Msg-id
2ced3259-2cb5-9ecc-3157-69b6cd3f51c8@gmx.net
Ответ на
Список
Дерево обсуждения
'{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? Bryn Llewellyn <bryn@yugabyte.com>
Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? Thomas Kellerer <shammat@gmx.net>
Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? Bryn Llewellyn <bryn@yugabyte.com>
Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? "David G. Johnston" <david.g.johnston@gmail.com>
Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? Bryn Llewellyn <bryn@yugabyte.com>
Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? Tom Lane <tgl@sss.pgh.pa.us>
Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? Bryn Llewellyn <bryn@yugabyte.com>
ISBN (was: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really?) "Peter J. Holzer" <hjp-pgsql@hjp.at>
Re: ISBN (was: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really?) Bryn Llewellyn <bryn@yugabyte.com>
Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? jian he <jian.universality@gmail.com>
Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? Bryn Llewellyn <bryn@yugabyte.com>
Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? Alban Hertroys <haramrae@gmail.com>
Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? Bryn Llewellyn <bryn@yugabyte.com>
Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? Merlin Moncure <mmoncure@gmail.com>
Bryn Llewellyn schrieb am 04.06.2022 um 03:41:
> Am I missing a use case where an object with a key-value pair with a
> JSON null value is meaningfully different from one where the key is
> simply absent?
It seems the JSON specification doesn't actually define equality.
But the JSON patch RFC 6902[1] defines the equality of two objects
as:

   objects: are considered equal if they contain the same number of
   members, and if each member can be considered equal to a member in
   the other object, by comparing their keys (as strings) and their
   values (using this list of type-specific rules).

As {"x": 42, "y": null} and {"x": 42} do not contain the same number
of members, I think Postgres' behaviour is correct.

Thomas


[1] https://www.rfc-editor.org/rfc/rfc6902#section-4.6


В списке pgsql-general по дате отправления
От: Bryn Llewellyn
Дата:
FAQ