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

Commit7548800

Browse files
author
Nikita Glukhov
committed
Use nodes JsonFomat and JsonReturning in JSON_ARRAY(query)
1 parent40b736f commit7548800

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

‎src/backend/nodes/copyfuncs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2423,7 +2423,7 @@ _copyJsonArrayQueryCtor(const JsonArrayQueryCtor *from)
24232423

24242424
COPY_NODE_FIELD(query);
24252425
COPY_NODE_FIELD(output);
2426-
COPY_SCALAR_FIELD(format);
2426+
COPY_NODE_FIELD(format);
24272427
COPY_SCALAR_FIELD(absent_on_null);
24282428
COPY_LOCATION_FIELD(location);
24292429

‎src/backend/parser/gram.y‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14846,6 +14846,7 @@ json_array_constructor:
1484614846
{
1484714847
JsonArrayQueryCtor *n =makeNode(JsonArrayQueryCtor);
1484814848
n->query = $3;
14849+
n->format =makeJsonFormat(JS_FORMAT_DEFAULT, JS_ENC_DEFAULT, -1);
1484914850
/* n->format = $4;*/
1485014851
n->absent_on_null =true/* $5*/;
1485114852
n->output = (JsonOutput *) $4;

‎src/backend/parser/parse_expr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4299,7 +4299,7 @@ transformJsonArrayCtor(ParseState *pstate, JsonArrayCtor *ctor)
42994299
jsctor=makeNode(JsonCtorExpr);
43004300
jsctor->args=args;
43014301
jsctor->type=JSCTOR_JSON_ARRAY;
4302-
jsctor->returning=transformJsonOutput(pstate,ctor->output,true);
4302+
jsctor->returning=transformJsonCtorOutput(pstate,ctor->output,args);
43034303
jsctor->unique= false;
43044304
jsctor->absent_on_null=ctor->absent_on_null;
43054305
jsctor->location=ctor->location;

‎src/test/regress/expected/sqljson.out‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,9 @@ LINE 1: SELECT JSON_ARRAY(RETURNING bytea FORMAT JSON ENCODING UTF32...
364364
^
365365
HINT: only UTF8 JSON encoding is supported
366366
SELECT JSON_ARRAY('aaa', 111, true, array[1,2,3], NULL, json '{"a": [1]}', jsonb '["a",3]');
367-
json_array
368-
---------------------------------------------------
369-
["aaa", 111, true, [1,2,3], {"a": [1]}, ["a", 3]]
367+
json_array
368+
-----------------------------------------------------
369+
["aaa", 111, true, [1, 2,3], {"a": [1]}, ["a", 3]]
370370
(1 row)
371371

372372
SELECT JSON_ARRAY('a', NULL, 'b' NULL ON NULL);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp