mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +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:
@ -2466,6 +2466,8 @@ expression_tree_walker(Node *node,
|
||||
return true;
|
||||
if (walker(tf->coldefexprs, context))
|
||||
return true;
|
||||
if (walker(tf->colvalexprs, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonValueExpr:
|
||||
@ -3513,6 +3515,7 @@ expression_tree_mutator(Node *node,
|
||||
MUTATE(newnode->rowexpr, tf->rowexpr, Node *);
|
||||
MUTATE(newnode->colexprs, tf->colexprs, List *);
|
||||
MUTATE(newnode->coldefexprs, tf->coldefexprs, List *);
|
||||
MUTATE(newnode->colvalexprs, tf->colvalexprs, List *);
|
||||
return (Node *) newnode;
|
||||
}
|
||||
break;
|
||||
@ -4530,6 +4533,30 @@ raw_expression_tree_walker(Node *node,
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonTable:
|
||||
{
|
||||
JsonTable *jt = (JsonTable *) node;
|
||||
|
||||
if (walker(jt->common, context))
|
||||
return true;
|
||||
if (walker(jt->columns, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonTableColumn:
|
||||
{
|
||||
JsonTableColumn *jtc = (JsonTableColumn *) node;
|
||||
|
||||
if (walker(jtc->typeName, context))
|
||||
return true;
|
||||
if (walker(jtc->on_empty, context))
|
||||
return true;
|
||||
if (walker(jtc->on_error, context))
|
||||
return true;
|
||||
if (jtc->coltype == JTC_NESTED && walker(jtc->columns, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized node type: %d",
|
||||
(int) nodeTag(node));
|
||||
|
Reference in New Issue
Block a user