pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Erik Wienhold <ewie@ewie.name>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: ​jsonb @@ jsonpath operator doc: ​Only the first item of the result is taken into account
Date: Mon, 03 Apr 2023 11:26:32 -0400
Message-ID: <1229727.1680535592@sss.pgh.pa.us> (raw)
In-Reply-To: <550248534.555107.1680534677029@office.mailbox.org>
References: <CACJufxE01sxgvtG4QEvRZPzs_roggsZeVvBSGpjM5tzE5hMCLA@mail.gmail.com>
	<202761461.525027.1680441711777@office.mailbox.org>
	<48ed779b-c405-ca4f-c2d1-5ecc0312d9a3@aklaver.com>
	<550248534.555107.1680534677029@office.mailbox.org>

Erik Wienhold <ewie@ewie.name> writes:
> What do you mean?  I responded to the OP's question.  It's not a suggestion
> to update the docs.  Obviously it's quite a mouthful and needs to be boiled
> 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-SQLJSON-PATH





view thread (14+ messages)  latest in thread

Message-ID: <1229727.1680535592@sss.pgh.pa.us>
Permalink:  ../1229727.1680535592@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1229727.1680535592@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ewie@ewie.name, adrian.klaver@aklaver.com
  Subject: Re: ​jsonb @@ jsonpath operator doc: ​Only the first item of the result is taken into account
  In-Reply-To: <1229727.1680535592@sss.pgh.pa.us>
  References: <CACJufxE01sxgvtG4QEvRZPzs_roggsZeVvBSGpjM5tzE5hMCLA@mail.gmail.com> <202761461.525027.1680441711777@office.mailbox.org> <48ed779b-c405-ca4f-c2d1-5ecc0312d9a3@aklaver.com> <550248534.555107.1680534677029@office.mailbox.org> <1229727.1680535592@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox