apache / datafusion-sqlparser-rs

Extensible SQL Lexer and Parser for Rust
Apache License 2.0
2.8k stars 543 forks source link

Fix the parsing error in MSSQL for multiple statements that include `DECLARE` statements #1497

Closed wugeer closed 1 week ago

wugeer commented 3 weeks ago

This PR resolves an error in MSSQL that occurs when parsing multiple SQL statements containing DECLARE statements.

before parse sql in mssql

declare @a int;
set @a = 2;
select @a * 4;

raise error

Error during parsing: ParserError("Expected: end of statement, found: set at Line: 2, Column: 1")

This resolves issue https://github.com/apache/datafusion-sqlparser-rs/issues/1450

iffyio commented 1 week ago

@wugeer in the meantime when you get the chance could you take a look at the compile issue? i think it likely just needs the latest changes from main incorporated

wugeer commented 1 week ago

@iffyio Thank you for your guidance. I have already fixed it. :)

alamb commented 1 week ago

Thanks again @wugeer and @iffyio