Skip to content

Commit

Permalink
Fix #7832 - Crash on "... RETURNING *" without INTO in PSQL.
Browse files Browse the repository at this point in the history
  • Loading branch information
asfernandes committed Nov 9, 2023
1 parent a276255 commit 32f7dfa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/dsql/StmtNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10971,7 +10971,7 @@ static ReturningClause* dsqlProcessReturning(DsqlCompilerScratch* dsqlScratch, d

auto inputFirst = input->first;

if (!inputFirst)
if (inputFirst->items.isEmpty())
{
// Process RETURNING *
inputFirst = FB_NEW_POOL(pool) ValueListNode(pool, 0u);
Expand Down
6 changes: 3 additions & 3 deletions src/dsql/parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -6042,7 +6042,7 @@ query_spec
rse->dsqlFirst = $2 ? $2->items[1] : NULL;
rse->dsqlSkip = $2 ? $2->items[0] : NULL;
rse->dsqlDistinct = $3;
rse->dsqlSelectList = $4;
rse->dsqlSelectList = $4->items.hasData() ? $4 : nullptr;
rse->dsqlFrom = $5;
rse->dsqlWhere = $6;
rse->dsqlGroup = $7;
Expand Down Expand Up @@ -6077,14 +6077,14 @@ skip_clause

%type <valueListNode> distinct_clause
distinct_clause
: DISTINCT { $$ = newNode<ValueListNode>(0); }
: DISTINCT { $$ = newNode<ValueListNode>(0u); }
| all_noise { $$ = NULL; }
;

%type <valueListNode> select_list
select_list
: select_items { $$ = $1; }
| '*' { $$ = NULL; }
| '*' { $$ = newNode<ValueListNode>(0u); }
;

%type <valueListNode> select_items
Expand Down

0 comments on commit 32f7dfa

Please sign in to comment.