From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Oleg Bartunov <obartunov(at)gmail(dot)com> |
Subject: | Re: json_query - redundant result |
Date: | 2022-04-28 13:49:15 |
Message-ID: | 58e4c722-0bb0-0678-1436-d52b7fdf1ea8@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2022-04-28 Th 04:16, Pavel Stehule wrote:
> Hi
>
> I am learning new JSON API, and I am not sure, how the result of
> JSON_QUERY in one case is correct. So I am asking here
>
> (2022-04-28 10:13:26) postgres=# SELECT JSON_QUERY(jsonb '[{"a":10,
> "b": 20}, {"a": 30, "b":100}]', '$.**.a' with wrapper);
> ┌──────────────────┐
> │ json_query │
> ╞══════════════════╡
> │ [10, 30, 10, 30] │
> └──────────────────┘
> (1 row)
>
> 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.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-04-28 13:55:08 | Re: src / test / regress / sql / triggers.sql first 10 lines. |
Previous Message | Peter Eisentraut | 2022-04-28 12:26:25 | Re: bogus: logical replication rows/cols combinations |