Re: Example of json_array_elements

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: carlos(at)coterobarros(dot)com, Pg Docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: Example of json_array_elements
Date: 2021-11-12 14:20:32
Message-ID: 6B42B8C7-A5EB-49AA-8199-D3CBCD3A9C40@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

> On 12 Nov 2021, at 13:18, PG Doc comments form <noreply(at)postgresql(dot)org> wrote:

> Maybe this example for json_array_elements is wrong?

No, the example works as intended and yields the output in the documentation:

postgres=# select * from json_array_elements('[1,true, [2,false]]');
value
-----------
1
true
[2,false]
(3 rows)

Your proposal is also syntactically correct, but it's not what the author
intended when writing the example:

postgres=# select * from json_array_elements('[[1,true], [2,false]]');
value
-----------
[1,true]
[2,false]
(2 rows)

--
Daniel Gustafsson https://vmware.com/

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2021-11-12 15:37:04 Re: Ltree pattern matching
Previous Message Bruce Momjian 2021-11-12 14:20:28 Re: \dp privileges "decoder" dropped in v12 of docs