Open
Description
Description
The current SqlParser allows an extraneous (unused) returning clause for INSERT.
To Reproduce
PartiQL> UPDATE a INSERT INTO b VALUE c RETURNING ALL NEW d RETURNING ALL NEW e
!!
Output:
(
dml
(
operations
(
dml_op_list
(
insert_value
(
id
b
(
case_insensitive
)
(
unqualified
)
)
(
id
c
(
case_insensitive
)
(
unqualified
)
)
null
null
)
)
)
(
from
(
scan
(
id
a
(
case_insensitive
)
(
unqualified
)
)
null
null
null
)
)
(
returning
(
returning_expr
(
returning_elem
(
all_new
)
(
returning_column
(
id
e
(
case_insensitive
)
(
unqualified
)
)
)
)
)
)
)
More Information
Other DML Base commands do NOT allow returning clauses. Only DML commands beginning with Update/From allow them. So, when we have an insert command after an update, it chooses the LAST returning clause. Note that the output above doesn't reference column d
.
I'm leaving a note in PartiQL Parser (experimental in branch antlr
) that mentions this issue.