mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +03:00
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
This commit is contained in:
@@ -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:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user