JSON_TABLE

Andrew Dunstan <andrew@dunslane.net>

Commit: 4e34747c88a03ede6e9d731727815e37273d4bc9
Author: Andrew Dunstan <andrew@dunslane.net>
Date: 2022-04-04T20:03:47Z
Releases: 15.0
JSON_TABLE

This feature allows jsonb data to be treated as a table and thus used in
a FROM clause like other tabular data. Data can be selected from the
jsonb using jsonpath expressions, and hoisted out of nested structures
in the jsonb to form multiple rows, more or less like an outer join.

Nikita Glukhov

Reviewers have included (in no particular order) Andres Freund, Alexander
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zhihong Yu (whose
name I previously misspelled), Himanshu Upadhyaya, Daniel Gustafsson,
Justin Pryzby.

Discussion: https://postgr.es/m/7e2cb85d-24cf-4abb-30a5-1a33715959bd@postgrespro.ru

Files

PathChange+/−
src/backend/commands/explain.c modified +7 −1
src/backend/executor/execExpr.c modified +1 −0
src/backend/executor/execExprInterp.c modified +16 −2
src/backend/executor/nodeTableFuncscan.c modified +14 −9
src/backend/nodes/copyfuncs.c modified +85 −0
src/backend/nodes/equalfuncs.c modified +65 −0
src/backend/nodes/nodeFuncs.c modified +27 −0
src/backend/nodes/outfuncs.c modified +29 −0
src/backend/nodes/readfuncs.c modified +31 −0
src/backend/parser/gram.y modified +194 −5
src/backend/parser/Makefile modified +1 −0
src/backend/parser/parse_clause.c modified +9 −3
src/backend/parser/parse_expr.c modified +26 −6
src/backend/parser/parse_jsontable.c added +466 −0
src/backend/parser/parse_relation.c modified +2 −1
src/backend/parser/parse_target.c modified +3 −0
src/backend/utils/adt/jsonpath_exec.c modified +436 −0
src/backend/utils/adt/ruleutils.c modified +223 −5
src/backend/utils/misc/queryjumble.c modified +2 −0
src/include/executor/execExpr.h modified +4 −0
src/include/nodes/nodes.h modified +4 −0
src/include/nodes/parsenodes.h modified +48 −0
src/include/nodes/primnodes.h modified +37 −2
src/include/parser/kwlist.h modified +3 −0
src/include/parser/parse_clause.h modified +3 −0
src/include/utils/jsonpath.h modified +4 −0
src/test/regress/expected/jsonb_sqljson.out modified +562 −0
src/test/regress/expected/json_sqljson.out modified +6 −0
src/test/regress/sql/jsonb_sqljson.sql modified +284 −0
src/test/regress/sql/json_sqljson.sql modified +4 −0
src/tools/pgindent/typedefs.list modified +9 −0

Discussion