1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-21 15:54:08 +03:00

doc: Fix some issues with JSON_TABLE() exampls

1. Remove an unused PASSING variable.

 2. Adjust formatting of JSON data used in an example to be valid
    under strict mode

Reported-by: Miłosz Chmura <mieszko4@gmail.com>
Author: Robert Treat <rob@xzilla.net>
Discussion: https://postgr.es/m/173859550337.1071.4748984213168572913@wrigleys.postgresql.org
This commit is contained in:
Amit Langote 2025-02-19 15:07:24 +09:00
parent 7edd2cbc53
commit 77cdee9ea9

View File

@ -19308,7 +19308,7 @@ SELECT jt.* FROM
SELECT jt.* FROM SELECT jt.* FROM
my_films, my_films,
JSON_TABLE (js, '$.favorites[*] ? (@.films[*].director == $filter)' JSON_TABLE (js, '$.favorites[*] ? (@.films[*].director == $filter)'
PASSING 'Alfred Hitchcock' AS filter, 'Vertigo' AS filter2 PASSING 'Alfred Hitchcock' AS filter
COLUMNS ( COLUMNS (
id FOR ORDINALITY, id FOR ORDINALITY,
kind text PATH '$.kind', kind text PATH '$.kind',
@ -19395,13 +19395,13 @@ SELECT jt.* FROM
<programlisting> <programlisting>
SELECT * FROM JSON_TABLE ( SELECT * FROM JSON_TABLE (
'{"favorites": '{"favorites":
{"movies": [{"movies":
[{"name": "One", "director": "John Doe"}, [{"name": "One", "director": "John Doe"},
{"name": "Two", "director": "Don Joe"}], {"name": "Two", "director": "Don Joe"}],
"books": "books":
[{"name": "Mystery", "authors": [{"name": "Brown Dan"}]}, [{"name": "Mystery", "authors": [{"name": "Brown Dan"}]},
{"name": "Wonder", "authors": [{"name": "Jun Murakami"}, {"name":"Craig Doe"}]}] {"name": "Wonder", "authors": [{"name": "Jun Murakami"}, {"name":"Craig Doe"}]}]
}}'::json, '$.favorites[*]' }]}'::json, '$.favorites[*]'
COLUMNS ( COLUMNS (
user_id FOR ORDINALITY, user_id FOR ORDINALITY,
NESTED '$.movies[*]' NESTED '$.movies[*]'