JSONPATH documentation

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: JSONPATH documentation
Date: 2019-09-22 18:18:04
Message-ID: CAMkU=1wP-SO4KpiLxHJuPezTJCmK=JqefLXrr3eXFO7Qku+tMg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I find the documentation in
https://www.postgresql.org/docs/12/functions-json.html very confusing.

In table 9.44 take the first entry,

Example JSON
{"x": [2.85, -14.7, -9.4]}

Example Query
+ $.x.floor()

Result
2, -15, -10

There are no end to end examples here. How do I apply the example query to
the example json to obtain the given result?

Table 9.47 only gives two operators which apply a jsonpath to a json(b)
object: @? and @@; and neither one of those yield the indicated result from
the first line in 9.44. What does?

Also, I can't really figure out what the descriptions of @? and @@ mean.
Does @? return true if an item exists, even if the value of that item is
false, while @@ returns the truth value of the existing item?

https://www.postgresql.org/docs/12/datatype-json.html#DATATYPE-JSONPATH

"The SQL/JSON path language is fully integrated into the SQL engine". What
does that mean? If it were only partially integrated, what would that
mean? Is this providing me with any useful information? Is this just
saying that this is not a contrib extension module?

What is the difference between "SQL/JSON Path Operators And Methods" and
and "jsonpath Accessors" and why are they not described in the same place,
or at least nearby each other?

Cheers,

Jeff

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-09-22 18:24:36 Re: [bug fix??] Fishy code in tts_cirtual_copyslot()
Previous Message Tom Lane 2019-09-22 16:28:02 Re: Wrong sentence in the README?