mirror of
https://github.com/postgres/postgres.git
synced 2025-08-27 07:42:10 +03:00
Common SQL/JSON clauses
This introduces some of the building blocks used by the SQL/JSON constructor and query functions. Specifically, it provides node executor and grammar support for the FORMAT JSON [ENCODING foo] clause, and values decorated with it, and for the RETURNING clause. The following SQL/JSON patches will leverage these. Nikita Glukhov (who probably deserves an award for perseverance). Reviewers have included (in no particular order) Andres Freund, Alexander Korotkov, Pavel Stehule, Andrew Alsup. Erik Rijkers, Zihong Yu and Himanshu Upadhyaya. Discussion: https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru
This commit is contained in:
@@ -3512,6 +3512,29 @@ eval_const_expressions_mutator(Node *node,
|
||||
return ece_evaluate_expr((Node *) newcre);
|
||||
return (Node *) newcre;
|
||||
}
|
||||
case T_JsonValueExpr:
|
||||
{
|
||||
JsonValueExpr *jve = (JsonValueExpr *) node;
|
||||
Node *raw = eval_const_expressions_mutator((Node *) jve->raw_expr,
|
||||
context);
|
||||
|
||||
if (raw && IsA(raw, Const))
|
||||
{
|
||||
Node *formatted;
|
||||
Node *save_case_val = context->case_val;
|
||||
|
||||
context->case_val = raw;
|
||||
|
||||
formatted = eval_const_expressions_mutator((Node *) jve->formatted_expr,
|
||||
context);
|
||||
|
||||
context->case_val = save_case_val;
|
||||
|
||||
if (formatted && IsA(formatted, Const))
|
||||
return formatted;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user