From: | Thomas Kellerer <shammat(at)gmx(dot)net> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? |
Date: | 2022-06-19 22:30:44 |
Message-ID: | 2ced3259-2cb5-9ecc-3157-69b6cd3f51c8@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-06-19 23:28:35 | Re: Outer joins and NULLs (old subject "ERROR: failed to find conversion function from key_vals_nn to record[]") |
Previous Message | Bryn Llewellyn | 2022-06-19 22:11:31 | Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? |