Skip to content

Commit 21e8d2a

Browse files
author
Nikita Glukhov
committed
Use nodes JsonFomat and JsonReturning in JsonCtorExpr
1 parent cb80df9 commit 21e8d2a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/backend/parser/gram.y

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14696,15 +14696,15 @@ json_func_expr:
1469614696
json_value_expr:
1469714697
a_expr json_format_clause_opt
1469814698
{
14699-
$$ = (Node *) makeJsonValueExpr((Expr *) $1, $2);
14699+
$$ = (Node *) makeJsonValueExpr((Expr *) $1, castNode(JsonFormat, $2));
1470014700
}
1470114701
;
1470214702

1470314703
json_format_clause_opt:
1470414704
FORMAT json_representation
1470514705
{
1470614706
$$ = $2;
14707-
$$.location = @1;
14707+
castNode(JsonFormat, $$)->location = @1;
1470814708
}
1470914709
| /* EMPTY */
1471014710
{
@@ -14734,7 +14734,8 @@ json_output_clause_opt:
1473414734
{
1473514735
JsonOutput *n = makeNode(JsonOutput);
1473614736
n->typeName = $2;
14737-
n->returning.format = $3;
14737+
n->returning = makeNode(JsonReturning);
14738+
n->returning->format = (JsonFormat *) $3;
1473814739
$$ = (Node *) n;
1473914740
}
1474014741
| /* EMPTY */ { $$ = NULL; }

src/include/nodes/parsenodes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,7 +1496,7 @@ typedef struct JsonOutput
14961496
{
14971497
NodeTag type;
14981498
TypeName *typeName; /* RETURNING type name, if specified */
1499-
JsonReturning returning; /* RETURNING FORMAT clause and type Oids */
1499+
JsonReturning *returning; /* RETURNING FORMAT clause and type Oids */
15001500
} JsonOutput;
15011501

15021502
/*
@@ -1547,7 +1547,7 @@ typedef struct JsonArrayQueryCtor
15471547
NodeTag type;
15481548
Node *query; /* subquery */
15491549
JsonOutput *output; /* RETURNING clause, if specified */
1550-
JsonFormat format; /* FORMAT clause for subquery, if specified */
1550+
JsonFormat *format; /* FORMAT clause for subquery, if specified */
15511551
bool absent_on_null; /* skip NULL elements? */
15521552
int location; /* token location, or -1 if unknown */
15531553
} JsonArrayQueryCtor;

0 commit comments

Comments
 (0)