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 1pjM4y-0002GZ-MO for pgsql-general@arkaria.postgresql.org; Mon, 03 Apr 2023 15:26:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pjM4x-0001kw-1N for pgsql-general@arkaria.postgresql.org; Mon, 03 Apr 2023 15:26:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pjM4w-0001kn-N9 for pgsql-general@lists.postgresql.org; Mon, 03 Apr 2023 15:26:42 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pjM4t-000eXx-KA for pgsql-general@lists.postgresql.org; Mon, 03 Apr 2023 15:26:42 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 333FQWiv1229728; Mon, 3 Apr 2023 11:26:32 -0400 From: Tom Lane To: Erik Wienhold cc: Adrian Klaver , pgsql-general list Subject: =?UTF-8?Q?Re:_=E2=80=8Bjsonb_@@_jsonpath_operator_doc:_=E2=80=8BO?= =?UTF-8?Q?nly_the_first_item_of_the_result_is_taken_into_account?= In-reply-to: <550248534.555107.1680534677029@office.mailbox.org> References: <202761461.525027.1680441711777@office.mailbox.org> <48ed779b-c405-ca4f-c2d1-5ecc0312d9a3@aklaver.com> <550248534.555107.1680534677029@office.mailbox.org> Comments: In-reply-to Erik Wienhold message dated "Mon, 03 Apr 2023 17:11:17 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1229726.1680535592.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 03 Apr 2023 11:26:32 -0400 Message-ID: <1229727.1680535592@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Erik Wienhold writes: > What do you mean? I responded to the OP's question. It's not a suggest= ion > to update the docs. Obviously it's quite a mouthful and needs to be boi= led > down for the docs. Any suggestions? At least for the example at hand, I think a good part of the confusion stems from the undocumented way that the boolean test operator works. As far as I can find, the only mention of that is in Section 9.16.2 [1], which says (just before 9.16.2.1): PostgreSQL's implementation of the SQL/JSON path language has the following deviations from the SQL/JSON standard: A path expression can be a Boolean predicate, although the SQL/JSON standard allows predicates only in filters. This is necessary for implementation of the @@ operator. For example, the following jsonpath expression is valid in PostgreSQL: $.track.segments[*].HR < 70 That is a complete documentation fail if you ask me, because it doesn't explain what the construct actually does, nor is there anyplace else where you could find that out, not even the SQL standard. So I'd start by fleshing that out, and then see what to do with the description of the @@ operator (and the equivalent jsonb_path_match function). Some more examples for those might help. regards, tom lane [1] https://www.postgresql.org/docs/devel/functions-json.html#FUNCTIONS-SQ= LJSON-PATH