JSON_TABLE PLAN clause This patch adds the PLAN clauses for JSON_TABLE, which allow the user to specify how data from nested paths are joined, allowing considerable freedom in shaping the tabular output of JSON_TABLE. PLAN DEFAULT allows the user to specify the global strategies when dealing with sibling or child nested paths. This is often sufficient to achieve the necessary goal, and is considerably simpler than the full PLAN clause, which allows the user to specify the strategy to be used for each named nested path.
Path names may be attached to the row pattern and to each NESTED path using AS. Unlike the SQL/JSON standard, which requires a name for every NESTED path when a PLAN clause is present, PostgreSQL does not require them and generates a name for any path left unnamed; a specific PLAN() can only reference paths by name, so unnamed paths it must mention are reported as not covered by the plan. Author: Nikita Malakhov <[email protected]> Co-authored-by: Nikita Glukhov <[email protected]> Co-authored-by: Teodor Sigaev <[email protected]> Co-authored-by: Oleg Bartunov <[email protected]> Co-authored-by: Alexander Korotkov <[email protected]> Co-authored-by: Andrew Dunstan <[email protected]> Co-authored-by: Amit Langote <[email protected]> Co-authored-by: Anton Melnikov <[email protected]> Reviewed-by: Andres Freund <[email protected]> Reviewed-by: Pavel Stehule <[email protected]> Reviewed-by: Andrew Alsup <[email protected]> Reviewed-by: Erik Rijkers <[email protected]> Reviewed-by: Zhihong Yu <[email protected]> Reviewed-by: Himanshu Upadhyaya <[email protected]> Reviewed-by: Daniel Gustafsson <[email protected]> Reviewed-by: Justin Pryzby <[email protected]> Reviewed-by: Álvaro Herrera <[email protected]> Reviewed-by: jian he <[email protected]> Reviewed-by: Vladlen Popolitov <[email protected]> Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=ojoy_tqsrhyt-q_kb6i5d4xckyrlc1...@mail.gmail.com Discussion: https://postgr.es/m/CAN-LCVP7HXmGu-WcinsHvdKqMGEdv=1Y67H4U58F6Y=q0m5...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/86ab7f4c721d61282c058acc0b4aa0b3adf04410 Modified Files -------------- doc/src/sgml/func/func-json.sgml | 176 ++++++- src/backend/catalog/sql_features.txt | 4 +- src/backend/nodes/makefuncs.c | 54 ++ src/backend/parser/gram.y | 101 +++- src/backend/parser/parse_jsontable.c | 382 +++++++++++--- src/backend/utils/adt/jsonpath_exec.c | 171 +++++-- src/backend/utils/adt/ruleutils.c | 99 ++++ src/include/nodes/makefuncs.h | 5 + src/include/nodes/parsenodes.h | 43 ++ src/include/nodes/primnodes.h | 2 + src/test/regress/expected/sqljson_jsontable.out | 655 +++++++++++++++++++++++- src/test/regress/sql/sqljson_jsontable.sql | 434 ++++++++++++++++ src/tools/pgindent/typedefs.list | 3 + 13 files changed, 2017 insertions(+), 112 deletions(-)
