public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Andrew Dunstan <[email protected]>
Cc: Pavel Stehule <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: Oleg Bartunov <[email protected]>
Subject: Re: json_query - redundant result
Date: Thu, 28 Apr 2022 10:00:53 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CAFj8pRDgxcD5imBqWODk0y_MKU=1Oek1CutTXpq1apZSBNbk5A@mail.gmail.com>
<[email protected]>
Andrew Dunstan <[email protected]> writes:
> On 2022-04-28 Th 04:16, Pavel Stehule wrote:
>> Is this result correct? I am expecting just [10, 30]
> It's just a wrapper around jsonb_path_query, which hasn't changed.
> # SELECT jsonb_path_query(jsonb '[{"a":10, "b": 20}, {"a": 30,
> "b":100}]', '$.**.a');
> jsonb_path_query
> ------------------
> 10
> 30
> 10
> 30
> (4 rows)
> If that's a bug it's not a new one - release 14 gives the same result.
I'm pretty clueless in this area, but I think this might have to do with
the "lax mode" described in 9.16.2.1:
https://www.postgresql.org/docs/devel/functions-json.html#FUNCTIONS-SQLJSON-PATH
regression=# SELECT jsonb_path_query(jsonb '[{"a":10, "b": 20}, {"a": 30,
regression'# "b":100}]', '$.**.a');
jsonb_path_query
------------------
10
30
10
30
(4 rows)
regression=# SELECT jsonb_path_query(jsonb '[{"a":10, "b": 20}, {"a": 30,
"b":100}]', 'strict $.**.a');
jsonb_path_query
------------------
10
30
(2 rows)
Maybe these SQL-standard syntaxes ought to default to strict mode?
regards, tom lane
view thread (4+ messages) latest in thread
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: json_query - redundant result
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox