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

Appearance settings

Commit 3a8a1f3

Browse filesBrowse files
committed
SQL/JSON: Fix some obsolete comments.
JSON_OBJECT(), JSON_OBJETAGG(), JSON_ARRAY(), and JSON_ARRAYAGG() added in 7081ac4 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
1 parent b81a71a commit 3a8a1f3
Copy full SHA for 3a8a1f3

File tree

Expand file treeCollapse file tree

1 file changed

+16
-17
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-17
lines changed

‎src/backend/parser/parse_expr.c

Copy file name to clipboardExpand all lines: src/backend/parser/parse_expr.c
+16-17Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3709,11 +3709,9 @@ makeJsonConstructorExpr(ParseState *pstate, JsonConstructorType type,
37093709
/*
37103710
* Transform JSON_OBJECT() constructor.
37113711
*
3712-
* JSON_OBJECT() is transformed into json[b]_build_object[_ext]() call
3713-
* depending on the output JSON format. The first two arguments of
3714-
* json[b]_build_object_ext() are absent_on_null and check_unique.
3715-
*
3716-
* Then function call result is coerced to the target type.
3712+
* JSON_OBJECT() is transformed into a JsonConstructorExpr node of type
3713+
* JSCTOR_JSON_OBJECT. The result is coerced to the target type given
3714+
* by ctor->output.
37173715
*/
37183716
static Node *
37193717
transformJsonObjectConstructor(ParseState *pstate, JsonObjectConstructor *ctor)
@@ -3903,10 +3901,11 @@ transformJsonAggConstructor(ParseState *pstate, JsonAggConstructor *agg_ctor,
39033901
/*
39043902
* Transform JSON_OBJECTAGG() aggregate function.
39053903
*
3906-
* JSON_OBJECTAGG() is transformed into
3907-
* json[b]_objectagg[_unique][_strict](key, value) call depending on
3908-
* the output JSON format. Then the function call result is coerced to the
3909-
* target output type.
3904+
* JSON_OBJECT() is transformed into a JsonConstructorExpr node of type
3905+
* JSCTOR_JSON_OBJECTAGG, which at runtime becomes a
3906+
* json[b]_object_agg[_unique][_strict](agg->arg->key, agg->arg->value) call
3907+
* depending on the output JSON format. The result is coerced to the target
3908+
* type given by agg->constructor->output.
39103909
*/
39113910
static Node *
39123911
transformJsonObjectAgg(ParseState *pstate, JsonObjectAgg *agg)
@@ -3966,9 +3965,11 @@ transformJsonObjectAgg(ParseState *pstate, JsonObjectAgg *agg)
39663965
/*
39673966
* Transform JSON_ARRAYAGG() aggregate function.
39683967
*
3969-
* JSON_ARRAYAGG() is transformed into json[b]_agg[_strict]() call depending
3970-
* on the output JSON format and absent_on_null. Then the function call result
3971-
* is coerced to the target output type.
3968+
* JSON_ARRAYAGG() is transformed into a JsonConstructorExpr node of type
3969+
* JSCTOR_JSON_ARRAYAGG, which at runtime becomes a
3970+
* json[b]_object_agg[_unique][_strict](agg->arg) call depending on the output
3971+
* JSON format. The result is coerced to the target type given by
3972+
* agg->constructor->output.
39723973
*/
39733974
static Node *
39743975
transformJsonArrayAgg(ParseState *pstate, JsonArrayAgg *agg)
@@ -4004,11 +4005,9 @@ transformJsonArrayAgg(ParseState *pstate, JsonArrayAgg *agg)
40044005
/*
40054006
* Transform JSON_ARRAY() constructor.
40064007
*
4007-
* JSON_ARRAY() is transformed into json[b]_build_array[_ext]() call
4008-
* depending on the output JSON format. The first argument of
4009-
* json[b]_build_array_ext() is absent_on_null.
4010-
*
4011-
* Then function call result is coerced to the target type.
4008+
* JSON_ARRAY() is transformed into a JsonConstructorExpr node of type
4009+
* JSCTOR_JSON_ARRAY. The result is coerced to the target type given
4010+
* by ctor->output.
40124011
*/
40134012
static Node *
40144013
transformJsonArrayConstructor(ParseState *pstate, JsonArrayConstructor *ctor)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.