diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2022-03-05 08:07:15 -0500 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2022-03-31 15:45:24 -0400 |
commit | 49082c2cc3d8167cca70cfe697afb064710828ca (patch) | |
tree | 004b744b04f1014bf82634f08ea62f98e6e619f7 /src/backend/nodes/nodeFuncs.c | |
parent | ad43a413c4f7f5d024a5b2f51e00d280a22f1874 (diff) | |
download | postgresql-49082c2cc3d8167cca70cfe697afb064710828ca.tar.gz postgresql-49082c2cc3d8167cca70cfe697afb064710828ca.zip |
RETURNING clause for JSON() and JSON_SCALAR()
This patch is extracted from a larger patch that allowed setting the
default returned value from these functions to json or jsonb. That had
problems, but this piece of it is fine. For these functions only json or
jsonb can be specified in the RETURNING clause.
Extracted from an original patch from Nikita Glukhov
Reviewers have included (in no particular order) Andres Freund, Alexander
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.
Discussion: https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru
Diffstat (limited to 'src/backend/nodes/nodeFuncs.c')
-rw-r--r-- | src/backend/nodes/nodeFuncs.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c index 4789ba69113..a094317bfc1 100644 --- a/src/backend/nodes/nodeFuncs.c +++ b/src/backend/nodes/nodeFuncs.c @@ -4364,9 +4364,25 @@ raw_expression_tree_walker(Node *node, } break; case T_JsonParseExpr: - return walker(((JsonParseExpr *) node)->expr, context); + { + JsonParseExpr *jpe = (JsonParseExpr *) node; + + if (walker(jpe->expr, context)) + return true; + if (walker(jpe->output, context)) + return true; + } + break; case T_JsonScalarExpr: - return walker(((JsonScalarExpr *) node)->expr, context); + { + JsonScalarExpr *jse = (JsonScalarExpr *) node; + + if (walker(jse->expr, context)) + return true; + if (walker(jse->output, context)) + return true; + } + break; case T_JsonSerializeExpr: { JsonSerializeExpr *jse = (JsonSerializeExpr *) node; |