pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Example of json_array_elements
2+ messages / 2 participants
[nested] [flat]

* Example of json_array_elements
@ 2021-11-12 12:18 PG Doc comments form <noreply@postgresql.org>
  2021-11-12 14:20 ` Re: Example of json_array_elements Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Doc comments form @ 2021-11-12 12:18 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: carlos@coterobarros.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/functions-json.html
Description:

Maybe this example for json_array_elements is wrong?

select * from json_array_elements('[1,true, [2,false]]')

It seems to me that it should be

select * from json_array_elements('[[1,true], [2,false]]')

Thank you for this extraordinary documentation!


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Example of json_array_elements
  2021-11-12 12:18 Example of json_array_elements PG Doc comments form <noreply@postgresql.org>
@ 2021-11-12 14:20 ` Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 0 replies; 2+ messages in thread

From: Daniel Gustafsson @ 2021-11-12 14:20 UTC (permalink / raw)
  To: carlos@coterobarros.com, Pg Docs <pgsql-docs@lists.postgresql.org>

> On 12 Nov 2021, at 13:18, PG Doc comments form <noreply@postgresql.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/






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-11-12 14:20 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 12:18 Example of json_array_elements PG Doc comments form <noreply@postgresql.org>
2021-11-12 14:20 ` Daniel Gustafsson <daniel@yesql.se>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox