From ef744ebb7340d42361ebd88d068b27b17e69de18 Mon Sep 17 00:00:00 2001 From: Amit Langote Date: Thu, 18 Apr 2024 14:38:12 +0900 Subject: SQL/JSON: Miscellaneous fixes and improvements This addresses some post-commit review comments for commits 6185c973, de3600452, and 9425c596a0, with the following changes: * Fix JSON_TABLE() syntax documentation to use the term "path_expression" for JSON path expressions instead of "json_path_specification" to be consistent with the other SQL/JSON functions. * Fix a typo in the example code in JSON_TABLE() documentation. * Rewrite some newly added comments in jsonpath.h. * In JsonPathQuery(), add missing cast to int before printing an enum value. Reported-by: Jian He Discussion: https://postgr.es/m/CACJufxG_e0QLCgaELrr2ZNz7AxPeGCNKAORe3fHtFCQLsH4J4Q@mail.gmail.com --- doc/src/sgml/func.sgml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 8dfb42ad4db..92a0f49e6a1 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -18942,7 +18942,7 @@ where json_table_column is: { ERROR | NULL | EMPTY { ARRAY | OBJECT } | DEFAULT expression } ON ERROR | name type EXISTS PATH path_expression { ERROR | TRUE | FALSE | UNKNOWN } ON ERROR - | NESTED PATH json_path_specification AS json_path_name COLUMNS ( json_table_column , ... ) + | NESTED PATH path_expression AS json_path_name COLUMNS ( json_table_column , ... ) @@ -19083,7 +19083,7 @@ where json_table_column is: - NESTED PATH json_path_specification AS json_path_name + NESTED PATH path_expression AS json_path_name COLUMNS ( json_table_column , ... ) @@ -19315,8 +19315,9 @@ SELECT * FROM JSON_TABLE ( "books": [{"name": "Mystery", "authors": [{"name": "Brown Dan"}]}, {"name": "Wonder", "authors": [{"name": "Jun Murakami"}, {"name":"Craig Doe"}]}] -}}'::json, '$.favs[*]' -COLUMNS (user_id FOR ORDINALITY, +}}'::json, '$.favorites[*]' +COLUMNS ( + user_id FOR ORDINALITY, NESTED '$.movies[*]' COLUMNS ( movie_id FOR ORDINALITY, -- cgit v1.2.3