diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2022-04-04 15:36:03 -0400 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2022-04-04 16:03:47 -0400 |
commit | 4e34747c88a03ede6e9d731727815e37273d4bc9 (patch) | |
tree | c7318a224b908c5dbaba3198324c90ec5429c3a5 /src/backend/nodes/outfuncs.c | |
parent | c42a6fc41dc22b42e5417224440c02893996afb4 (diff) | |
download | postgresql-4e34747c88a03ede6e9d731727815e37273d4bc9.tar.gz postgresql-4e34747c88a03ede6e9d731727815e37273d4bc9.zip |
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
Diffstat (limited to 'src/backend/nodes/outfuncs.c')
-rw-r--r-- | src/backend/nodes/outfuncs.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index 6e39590730a..213396f9992 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -1092,6 +1092,7 @@ _outTableFunc(StringInfo str, const TableFunc *node) { WRITE_NODE_TYPE("TABLEFUNC"); + WRITE_ENUM_FIELD(functype, TableFuncType); WRITE_NODE_FIELD(ns_uris); WRITE_NODE_FIELD(ns_names); WRITE_NODE_FIELD(docexpr); @@ -1102,7 +1103,9 @@ _outTableFunc(StringInfo str, const TableFunc *node) WRITE_NODE_FIELD(colcollations); WRITE_NODE_FIELD(colexprs); WRITE_NODE_FIELD(coldefexprs); + WRITE_NODE_FIELD(colvalexprs); WRITE_BITMAPSET_FIELD(notnulls); + WRITE_NODE_FIELD(plan); WRITE_INT_FIELD(ordinalitycol); WRITE_LOCATION_FIELD(location); } @@ -1866,6 +1869,26 @@ _outJsonItemCoercions(StringInfo str, const JsonItemCoercions *node) WRITE_NODE_FIELD(composite); } +static void +_outJsonTableParent(StringInfo str, const JsonTableParent *node) +{ + WRITE_NODE_TYPE("JSONTABPNODE"); + + WRITE_NODE_FIELD(path); + WRITE_NODE_FIELD(child); + WRITE_INT_FIELD(colMin); + WRITE_INT_FIELD(colMax); +} + +static void +_outJsonTableSibling(StringInfo str, const JsonTableSibling *node) +{ + WRITE_NODE_TYPE("JSONTABSNODE"); + + WRITE_NODE_FIELD(larg); + WRITE_NODE_FIELD(rarg); +} + /***************************************************************************** * * Stuff from pathnodes.h. @@ -4714,6 +4737,12 @@ outNode(StringInfo str, const void *obj) case T_JsonItemCoercions: _outJsonItemCoercions(str, obj); break; + case T_JsonTableParent: + _outJsonTableParent(str, obj); + break; + case T_JsonTableSibling: + _outJsonTableSibling(str, obj); + break; default: |