Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7768b65

Browse files
committed
SQL/JSON: Fix some obsolete comments.
JSON_OBJECT(), JSON_OBJETAGG(), JSON_ARRAY(), and JSON_ARRAYAGG()added in7081ac4 are not transformed into direct calls touser-defined functions as the comments claim. Fix by mentioninginstead 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.comBackpatch-through: 16
1 parent54a7b21 commit7768b65

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

‎src/backend/parser/parse_expr.c

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3561,11 +3561,9 @@ makeJsonConstructorExpr(ParseState *pstate, JsonConstructorType type,
35613561
/*
35623562
* Transform JSON_OBJECT() constructor.
35633563
*
3564-
* JSON_OBJECT() is transformed into json[b]_build_object[_ext]() call
3565-
* depending on the output JSON format. The first two arguments of
3566-
* json[b]_build_object_ext() are absent_on_null and check_unique.
3567-
*
3568-
* Then function call result is coerced to the target type.
3564+
* JSON_OBJECT() is transformed into a JsonConstructorExpr node of type
3565+
* JSCTOR_JSON_OBJECT. The result is coerced to the target type given
3566+
* by ctor->output.
35693567
*/
35703568
staticNode*
35713569
transformJsonObjectConstructor(ParseState*pstate,JsonObjectConstructor*ctor)
@@ -3753,10 +3751,11 @@ transformJsonAggConstructor(ParseState *pstate, JsonAggConstructor *agg_ctor,
37533751
/*
37543752
* Transform JSON_OBJECTAGG() aggregate function.
37553753
*
3756-
* JSON_OBJECTAGG() is transformed into
3757-
* json[b]_objectagg[_unique][_strict](key, value) call depending on
3758-
* the output JSON format. Then the function call result is coerced to the
3759-
* target output type.
3754+
* JSON_OBJECT() is transformed into a JsonConstructorExpr node of type
3755+
* JSCTOR_JSON_OBJECTAGG, which at runtime becomes a
3756+
* json[b]_object_agg[_unique][_strict](agg->arg->key, agg->arg->value) call
3757+
* depending on the output JSON format. The result is coerced to the target
3758+
* type given by agg->constructor->output.
37603759
*/
37613760
staticNode*
37623761
transformJsonObjectAgg(ParseState*pstate,JsonObjectAgg*agg)
@@ -3815,9 +3814,11 @@ transformJsonObjectAgg(ParseState *pstate, JsonObjectAgg *agg)
38153814
/*
38163815
* Transform JSON_ARRAYAGG() aggregate function.
38173816
*
3818-
* JSON_ARRAYAGG() is transformed into json[b]_agg[_strict]() call depending
3819-
* on the output JSON format and absent_on_null. Then the function call result
3820-
* is coerced to the target output type.
3817+
* JSON_ARRAYAGG() is transformed into a JsonConstructorExpr node of type
3818+
* JSCTOR_JSON_ARRAYAGG, which at runtime becomes a
3819+
* json[b]_object_agg[_unique][_strict](agg->arg) call depending on the output
3820+
* JSON format. The result is coerced to the target type given by
3821+
* agg->constructor->output.
38213822
*/
38223823
staticNode*
38233824
transformJsonArrayAgg(ParseState*pstate,JsonArrayAgg*agg)
@@ -3854,11 +3855,9 @@ transformJsonArrayAgg(ParseState *pstate, JsonArrayAgg *agg)
38543855
/*
38553856
* Transform JSON_ARRAY() constructor.
38563857
*
3857-
* JSON_ARRAY() is transformed into json[b]_build_array[_ext]() call
3858-
* depending on the output JSON format. The first argument of
3859-
* json[b]_build_array_ext() is absent_on_null.
3860-
*
3861-
* Then function call result is coerced to the target type.
3858+
* JSON_ARRAY() is transformed into a JsonConstructorExpr node of type
3859+
* JSCTOR_JSON_ARRAY. The result is coerced to the target type given
3860+
* by ctor->output.
38623861
*/
38633862
staticNode*
38643863
transformJsonArrayConstructor(ParseState*pstate,JsonArrayConstructor*ctor)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp