Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o33RV-0005rZ-3B for pgsql-general@arkaria.postgresql.org; Sun, 19 Jun 2022 22:30:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o33RT-00079D-Nn for pgsql-general@arkaria.postgresql.org; Sun, 19 Jun 2022 22:30:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o33RT-000794-CT for pgsql-general@lists.postgresql.org; Sun, 19 Jun 2022 22:30:51 +0000 Received: from mout.gmx.net ([212.227.15.19]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o33RP-0003Sc-98 for pgsql-general@lists.postgresql.org; Sun, 19 Jun 2022 22:30:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1655677845; bh=gRaHpHClLPPh4OJQv2+WmEp9MnGbQ4cPnUFL0cxO+gQ=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=GC/iAdmtuuf5FU1aKy4YMfNnwJWZObFXvYJUvf1K1twf+dV1gXq6CiAY0UiocqCkG LoEnxxCdC/Bd4nDUZZiNHNnFxr7NizCXHJO0Vi2bm6IxjvyB4VmI0A2EA5bTCcj7wp oone349Mftw6OfzQVAhwafu8tsHggHYTsJaQ5QdE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.178.20] ([83.171.161.172]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Ma24s-1oFD4i402O-00VwOz for ; Mon, 20 Jun 2022 00:30:45 +0200 Subject: Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? To: pgsql-general@lists.postgresql.org References: <7E0BF7DF-CC12-48B6-8550-9C2B5A8F78B1@yugabyte.com> From: Thomas Kellerer Message-ID: <2ced3259-2cb5-9ecc-3157-69b6cd3f51c8@gmx.net> Date: Mon, 20 Jun 2022 00:30:44 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: <7E0BF7DF-CC12-48B6-8550-9C2B5A8F78B1@yugabyte.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:/xo10IelzNBDnBDW58dIQBiwmeLrza4zhayA5Xb/NICb+7jp9Y+ MW3Bl5A9enFx/G2+muWuCKsdcfAADfyIIdc7SX+jDoqZmPJCTQ6fCTaBQABaqHWgm5HSIkJ CduipvwwLePScpwVMqw06/jsaYCmUkrGWeY+1tjq4hrmZd+3vU6saDRW3g9AyvYeY/fV3hj N36bQOkVnuMFmvL7FTFQw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:1/TC/QXOUE8=:Rk8gMtF7kQo3fwq0iudUn0 gEfdgVH/Al2jYwn7PRMTEsFcMixEQgreu0VWyqApjiaFtXx3TDrel6ghiWheAt49PuC6IFK51 I2kOY9PwK1xFgxITBbUSfMfLp87HDfkak8RQRgmTbdMo8Nhw5cf86bfEysfsSYMuvtvyj/+iB iidFA0bhZzmtpk7yuCM4+MVO8zuxzPpZCORSMuXZXYKdN44zuiMFDn0tQIWi6ciLeRDEalnF9 Xilxr8UcAq6ALrokVEULGx0gCNK3GBHv+pItE2tCMUCtyK5IcyaiTWJedQ/Ab7JwYM9r2jzo6 A38U4/AnYQGZoNK/4MFXZDBCsSBCUQjM9lZw3Cd7EmdJDuXCx6D7KCeLDhPtTEh3Mnl/TqlWa b2rh4MiAF103pwuTwywFY+vXJYnZpMHkxhRnLMeI1tLnrL1PXXWhNToZ8UWIcQ6oiuEVroh5Z GPzHvZ6cA8Giz4CrnWoAEqtnZtobMMX95aYicuOXWIuIuA2uZbU8evJbU9fHHT7dKpsRclv0A fLnjySMwvlg0ifzszElK1xx2891mhe/4cW/Id0TQUh6W7aAl9+M7VqrTDqvZosAqEwK7AMHKu JZdFYL9kV4nVe8mWPTxIn6AY6HISQhmcikHkzWUfScy3cHuxN5EsLwGbNDlO+Y7DNjHs5xuc7 WOICrV4e7lUKPlhbY7XHnZ57zK6k76yU0se85I0Sx/QnAt/LaI/H2xxlSq9jg2qlW7XXuQ+PK uT/rO6GYpbYARXCPLDVS7wZ43SoS7UfhixY+y2L47UU0sgLobmb6GNcA6H6S2B3/ln7z762H2 LwxNLh+4xu9wTRVL1r7RzJW8vs9Z7FwhKB5XfEwUYarjcTUyG/7A16J9SKauNihXq0DPr6Co/ A1I23583GvdMtFgfrqarUNELiGP7eGiV0UwWpDzbvBu8AL/npp43kd97DwnrVsmxtFz/lJC5X ORwCKvNP8VCqK9j7koLEydgiFxB3/C+5iwh+QcNVbRt52HdPJDy449uaYTpCRJBTzjHYdN95d 79exVas5RFuv3aCm7iGdtN5qVWFQFm1xHNcDi6RaYXD3JC1eaF4bpQWivACmal6Gx77yYwjBW 1bJTP5R6KLf6cWetpjblPOZAm9fnubiVnOZ4I9IZ4Lu91alr5vcrvYmow== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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