agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedJSON path query returns duplicate values
2+ messages / 1 participants
[nested] [flat]
* JSON path query returns duplicate values
@ 2020-12-21 09:43 Thomas Kellerer <shammat@gmx.net>
2020-12-29 14:14 ` Re: JSON path query returns duplicate values Thomas Kellerer <shammat@gmx.net>
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Kellerer @ 2020-12-21 09:43 UTC (permalink / raw)
To: pgsql-sql@lists.postgresql.org
Hello,
I wonder why this query
select jsonb_path_query_array(col, '$.**.itemName')
from (
values ('{"items": [{"itemName": "a", "items": [{"itemName": "b"}]}]}'::jsonb)
) as t(col)
returns each itemName twice: ["a", "a", "b", "b"]
I would have expected: ["a", "b"]
Thomas
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: JSON path query returns duplicate values
2020-12-21 09:43 JSON path query returns duplicate values Thomas Kellerer <shammat@gmx.net>
@ 2020-12-29 14:14 ` Thomas Kellerer <shammat@gmx.net>
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Kellerer @ 2020-12-29 14:14 UTC (permalink / raw)
To: pgsql-sql@lists.postgresql.org
Thomas Kellerer schrieb am 21.12.2020 um 10:43:
> I wonder why this query
>
> select jsonb_path_query_array(col, '$.**.itemName')
> from (
> values ('{"items": [{"itemName": "a", "items": [{"itemName": "b"}]}]}'::jsonb)
> ) as t(col)
>
> returns each itemName twice: ["a", "a", "b", "b"]
>
> I would have expected: ["a", "b"]
Is this a bug or intended?
If it's intended, I would really like to know the reason.
At least to me the result is quite surprsing.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2020-12-29 14:14 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 09:43 JSON path query returns duplicate values Thomas Kellerer <shammat@gmx.net>
2020-12-29 14:14 ` Thomas Kellerer <shammat@gmx.net>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox