JSON path query returns duplicate values

From: Thomas Kellerer <shammat(at)gmx(dot)net>
To: pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: JSON path query returns duplicate values
Date: 2020-12-21 09:43:18
Message-ID: 1bbaff39-e7be-c579-779f-4ead5b47ac57@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Kellerer 2020-12-29 14:14:05 Re: JSON path query returns duplicate values
Previous Message ml 2020-12-21 05:07:57 Re: dblink_exists