Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSQL: PRS error: multiple statements sql code containing WITH-UPDATE statement #2075

Closed
tkachenkomaria244 opened this issue Dec 9, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@tkachenkomaria244
Copy link
Contributor

SQL file with multiple statements inside gives parsing error if one of the statements is "with_compound_statement" with "update_statement" inside.
Although separate "with_compound_statement" with "update_statement" inside is parsed correctly.

Expected Behaviour

no parsing errors

Observed Behaviour

SQL file with multiple sql statements is not parsed if one of the statements is contains ("WITH-UPDATE"):

select * from tbl1;

with src as 
(
	select src.cc_id from dst 
	join src on src.rn = 1
)
update dst
set rn = rn - 1
from dst
join  src on dst.cc_id = src.cc_id;

select * from tbl1;

Variants which are parsed well :
multiple sql-statements code with GO after the "WITH-UPDATE" ;
multiple sql-statements without any statements after "WITH-UPDATE" ;
multiple sql-statements with any combinations having just statement "UPDATE" (not combination "WITH-UPDATE")
just one sql statement "WITH-UPDATE"

select * from tbl1;

with src as 
(
	select src.cc_id from dst 
	join src on src.rn = 1
)
update dst
set rn = rn - 1
from dst
join  src on dst.cc_id = src.cc_id;

go

select * from tbl1;

Dialect

TSQL

Version

Python 3.9
SQLFluff 0.8.2

@tkachenkomaria244 tkachenkomaria244 added the bug Something isn't working label Dec 9, 2021
@tkachenkomaria244
Copy link
Contributor Author

tkachenkomaria244 commented Dec 11, 2021

this issue is fixed within #2044

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant