mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +03:00
Code review for commit b6e1157e7d
b6e1157e7d made some changes to enforce that
JsonValueExpr.formatted_expr is always set and is the expression that
gives a JsonValueExpr its runtime value, but that's not really
apparent from the comments about and the code manipulating
formatted_expr. This commit fixes that.
Per suggestion from Álvaro Herrera.
Discussion: https://postgr.es/m/20230718155313.3wqg6encgt32adqb%40alvherre.pgsql
This commit is contained in:
@@ -848,16 +848,13 @@ makeJsonFormat(JsonFormatType type, JsonEncoding encoding, int location)
|
||||
* creates a JsonValueExpr node
|
||||
*/
|
||||
JsonValueExpr *
|
||||
makeJsonValueExpr(Expr *expr, JsonFormat *format)
|
||||
makeJsonValueExpr(Expr *raw_expr, Expr *formatted_expr,
|
||||
JsonFormat *format)
|
||||
{
|
||||
JsonValueExpr *jve = makeNode(JsonValueExpr);
|
||||
|
||||
jve->raw_expr = expr;
|
||||
|
||||
/*
|
||||
* Set after checking the format, if needed, in transformJsonValueExpr().
|
||||
*/
|
||||
jve->formatted_expr = NULL;
|
||||
jve->raw_expr = raw_expr;
|
||||
jve->formatted_expr = formatted_expr;
|
||||
jve->format = format;
|
||||
|
||||
return jve;
|
||||
|
||||
@@ -225,9 +225,7 @@ exprType(const Node *expr)
|
||||
{
|
||||
const JsonValueExpr *jve = (const JsonValueExpr *) expr;
|
||||
|
||||
type = exprType((Node *)
|
||||
(jve->formatted_expr ? jve->formatted_expr :
|
||||
jve->raw_expr));
|
||||
type = exprType((Node *) jve->formatted_expr);
|
||||
}
|
||||
break;
|
||||
case T_JsonConstructorExpr:
|
||||
|
||||
Reference in New Issue
Block a user