diff options
author | Amit Langote <amitlan@postgresql.org> | 2024-06-28 15:09:59 +0900 |
---|---|---|
committer | Amit Langote <amitlan@postgresql.org> | 2024-07-04 16:17:10 +0900 |
commit | 7768b6569de95de7517bd6520acbe6e599fc6601 (patch) | |
tree | a5bef084d046e71b8557a532f1a538b66ae969e3 | |
parent | 54a7b21b3a9dc4c8be5f7fec47e435ce5b1772bb (diff) | |
download | postgresql-7768b6569de95de7517bd6520acbe6e599fc6601.tar.gz postgresql-7768b6569de95de7517bd6520acbe6e599fc6601.zip |
SQL/JSON: Fix some obsolete comments.
JSON_OBJECT(), JSON_OBJETAGG(), JSON_ARRAY(), and JSON_ARRAYAGG()
added in 7081ac46ace are not transformed into direct calls to
user-defined functions as the comments claim. Fix by mentioning
instead that they are transformed into JsonConstructorExpr nodes,
which may call them, for example, for the *AGG() functions.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/058c856a-e090-ac42-ff00-ffe394f52a87%40gmail.com
Backpatch-through: 16
-rw-r--r-- | src/backend/parser/parse_expr.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index 5316275b69c..ba3448f9dd5 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -3561,11 +3561,9 @@ makeJsonConstructorExpr(ParseState *pstate, JsonConstructorType type, /* * Transform JSON_OBJECT() constructor. * - * JSON_OBJECT() is transformed into json[b]_build_object[_ext]() call - * depending on the output JSON format. The first two arguments of - * json[b]_build_object_ext() are absent_on_null and check_unique. - * - * Then function call result is coerced to the target type. + * JSON_OBJECT() is transformed into a JsonConstructorExpr node of type + * JSCTOR_JSON_OBJECT. The result is coerced to the target type given + * by ctor->output. */ static Node * transformJsonObjectConstructor(ParseState *pstate, JsonObjectConstructor *ctor) @@ -3753,10 +3751,11 @@ transformJsonAggConstructor(ParseState *pstate, JsonAggConstructor *agg_ctor, /* * Transform JSON_OBJECTAGG() aggregate function. * - * JSON_OBJECTAGG() is transformed into - * json[b]_objectagg[_unique][_strict](key, value) call depending on - * the output JSON format. Then the function call result is coerced to the - * target output type. + * JSON_OBJECT() is transformed into a JsonConstructorExpr node of type + * JSCTOR_JSON_OBJECTAGG, which at runtime becomes a + * json[b]_object_agg[_unique][_strict](agg->arg->key, agg->arg->value) call + * depending on the output JSON format. The result is coerced to the target + * type given by agg->constructor->output. */ static Node * transformJsonObjectAgg(ParseState *pstate, JsonObjectAgg *agg) @@ -3815,9 +3814,11 @@ transformJsonObjectAgg(ParseState *pstate, JsonObjectAgg *agg) /* * Transform JSON_ARRAYAGG() aggregate function. * - * JSON_ARRAYAGG() is transformed into json[b]_agg[_strict]() call depending - * on the output JSON format and absent_on_null. Then the function call result - * is coerced to the target output type. + * JSON_ARRAYAGG() is transformed into a JsonConstructorExpr node of type + * JSCTOR_JSON_ARRAYAGG, which at runtime becomes a + * json[b]_object_agg[_unique][_strict](agg->arg) call depending on the output + * JSON format. The result is coerced to the target type given by + * agg->constructor->output. */ static Node * transformJsonArrayAgg(ParseState *pstate, JsonArrayAgg *agg) @@ -3854,11 +3855,9 @@ transformJsonArrayAgg(ParseState *pstate, JsonArrayAgg *agg) /* * Transform JSON_ARRAY() constructor. * - * JSON_ARRAY() is transformed into json[b]_build_array[_ext]() call - * depending on the output JSON format. The first argument of - * json[b]_build_array_ext() is absent_on_null. - * - * Then function call result is coerced to the target type. + * JSON_ARRAY() is transformed into a JsonConstructorExpr node of type + * JSCTOR_JSON_ARRAY. The result is coerced to the target type given + * by ctor->output. */ static Node * transformJsonArrayConstructor(ParseState *pstate, JsonArrayConstructor *ctor) |