Skip to content

Commit 32f7dfa

Browse files
committed
Fix #7832 - Crash on "... RETURNING *" without INTO in PSQL.
1 parent a276255 commit 32f7dfa

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/dsql/StmtNodes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10971,7 +10971,7 @@ static ReturningClause* dsqlProcessReturning(DsqlCompilerScratch* dsqlScratch, d
1097110971

1097210972
auto inputFirst = input->first;
1097310973

10974-
if (!inputFirst)
10974+
if (inputFirst->items.isEmpty())
1097510975
{
1097610976
// Process RETURNING *
1097710977
inputFirst = FB_NEW_POOL(pool) ValueListNode(pool, 0u);

src/dsql/parse.y

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6042,7 +6042,7 @@ query_spec
60426042
rse->dsqlFirst = $2 ? $2->items[1] : NULL;
60436043
rse->dsqlSkip = $2 ? $2->items[0] : NULL;
60446044
rse->dsqlDistinct = $3;
6045-
rse->dsqlSelectList = $4;
6045+
rse->dsqlSelectList = $4->items.hasData() ? $4 : nullptr;
60466046
rse->dsqlFrom = $5;
60476047
rse->dsqlWhere = $6;
60486048
rse->dsqlGroup = $7;
@@ -6077,14 +6077,14 @@ skip_clause
60776077

60786078
%type <valueListNode> distinct_clause
60796079
distinct_clause
6080-
: DISTINCT { $$ = newNode<ValueListNode>(0); }
6080+
: DISTINCT { $$ = newNode<ValueListNode>(0u); }
60816081
| all_noise { $$ = NULL; }
60826082
;
60836083

60846084
%type <valueListNode> select_list
60856085
select_list
60866086
: select_items { $$ = $1; }
6087-
| '*' { $$ = NULL; }
6087+
| '*' { $$ = newNode<ValueListNode>(0u); }
60886088
;
60896089

60906090
%type <valueListNode> select_items

0 commit comments

Comments
 (0)