Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rjyeh-009No6-7j for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Mar 2024 09:42:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rjyed-009GF7-SU for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Mar 2024 09:42:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rjyed-009GBA-I9 for pgsql-hackers@lists.postgresql.org; Tue, 12 Mar 2024 09:42:40 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rjyea-0045Wt-Vk for pgsql-hackers@postgresql.org; Tue, 12 Mar 2024 09:42:39 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a45bb2a9c20so623504166b.0 for ; Tue, 12 Mar 2024 02:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710236556; x=1710841356; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=M/C3dKM9DcUfT14rPJJ9pnUBmu7TUfxuSV6OBgMTCtw=; b=FkRYH4AlkBv9u8928G+i6+7KY0f3fYitImRqKSpOhbxLrjeHdtDkantlRUcgZdFv47 LIKzuVTm3VdTvFmNHOKR2BLOQbsLXVUwmnkYzox28lRrFNdN7o9BTxtSnNw19wltRa20 pC4cvpRoMWP9eKnocNNOLTyxLbOgN00R7K0FjLTrzqsVXQvLX4RAoUW542vK4mIZ366F 5HMyu5DdTM8h7vEpjroBvolP/PXFmbNDLBbXix39atRIya+XNUsuanWwvK36KMQuVLSo TLqw6unnWU7CTncsYA7154lJJoP8KtvGadORmnixQhGl+/TTRMQ9G2SQyfRq1q4AuEmt jpuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236556; x=1710841356; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=M/C3dKM9DcUfT14rPJJ9pnUBmu7TUfxuSV6OBgMTCtw=; b=VIIQEAWWGFx/li3vekhqvW5Rnv6svMkrXCbzc+Q4iRlCjHBv1NT233sfsbKaf98kPV SiVmvHZPGX3XgzD5v8PrCOrTBaEDJGW09uvIfWuBL63lEcW07tEnrtwU4MOGNuivcy+o cImJfsbNYM2jqJRyuE68dNpP2E6kgOwOd28Yo7SaK6i3Y5tWnbZrSGadynZ/2s6fCrI5 n/1xC9i0MAYQZkjqbokZv8Se7WB45tLRXmMLsopmTKibsi1sYnT7oUrSa5CiO1op3sZJ 57tITXigEJrhlUu1fDM29vRiw3oC5tuvBMSv7ADEhlcsFluKnGtIXDioUL7qdk3FcsHS 87GA== X-Forwarded-Encrypted: i=1; AJvYcCVFUCS8qGYZahlRrfJz+L8Z57sX9QDUJNjTUQq/0855nmcR66gvAbNo+Kg+HFj9xNxo9ED39ntYwneJ1PdYX/lOPNzu827zN+MN4FWC X-Gm-Message-State: AOJu0YyThC1fr2L7FtIpU5L+9X7PlNPuvXJ6V09/H3Bd6jNNpc4Ch5A0 /V5a4E0Jw1nr2Mpo6t25nSy40FIG52ZXO4JNGH1hDheCvyXdKeWUo6xc/sjvk/nDCH65U0+HUhQ 8ELz9AzGHV0SPRAEyhiqrcrU55hY= X-Google-Smtp-Source: AGHT+IGyl8TBrnfFXV5dHPlSjfO9d1ka3UN0QyJSbGHy7Oc119CIVKVpMAWeBDYfdVRmxXXV7O1Ac4dLfejZ0iSoA/4= X-Received: by 2002:a17:906:38d2:b0:a46:24fd:4a75 with SMTP id r18-20020a17090638d200b00a4624fd4a75mr2142566ejd.29.1710236555826; Tue, 12 Mar 2024 02:42:35 -0700 (PDT) MIME-Version: 1.0 References: <202403111534.xii7yxswadef@alvherre.pgsql> In-Reply-To: From: Himanshu Upadhyaya Date: Tue, 12 Mar 2024 15:11:58 +0530 Message-ID: Subject: Re: remaining sql/json patches To: Alvaro Herrera , Amit Langote Cc: jian he , Andres Freund , Andrew Dunstan , Erik Rijkers , PostgreSQL-development , Tomas Vondra Content-Type: multipart/alternative; boundary="000000000000645f750613737aca" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000645f750613737aca Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, wanted to share the below case: =E2=80=98postgres[146443]=3D#=E2=80=99SELECT JSON_EXISTS(jsonb '{"customer_= name": "test", "salary":1000, "department_id":1}', '$.* ? (@=3D=3D $dept_id && @ =3D=3D $s= al)' PASSING 1000 AS sal, 1 as dept_id); json_exists ------------- f (1 row) isn't it supposed to return "true" as json in input is matching with both the condition dept_id and salary? --=20 Regards, Himanshu Upadhyaya EnterpriseDB: http://www.enterprisedb.com --000000000000645f750613737aca Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

wanted to share the belo= w case:

=E2=80=98postgres[146443]=3D#=E2=80=99SELE= CT JSON_EXISTS(jsonb '{"customer_name": "test", &qu= ot;salary":1000, "department_id":1}', '$.* ? (@=3D= =3D $dept_id && @ =3D=3D $sal)' PASSING 1000 AS sal, 1 as dept_= id);
=C2=A0json_exists
-------------
=C2=A0f
(1 row)
=

isn't it supposed to=C2=A0return=C2=A0"true&qu= ot; as json in input is matching with both the condition=C2=A0dept_id and s= alary?

--
Regards, Himanshu Upadhyaya
EnterpriseDB: http://www.enterprisedb.com
--000000000000645f750613737aca--