agis opened a new issue, #1858:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1858
Using `0.56.0` and the following code:
```rust
use sqlparser::dialect::PostgreSqlDialect;
use sqlparser::parser::Parser as Parser;
fn f()
let dialect = PostgreSqlDialect {};
let sql = r#"-- foo
ALTER TABLE users
ADD COLUMN foo
varchar; -- hi there
-- bar
-- baz
ALTER TABLE users ADD COLUMN bar varchar; SELECT 1;"#;
let ast = Parser::parse_sql(&dialect, sql).unwrap();
for stmt in ast {
let s = stmt.span();
println!("stmt: {} | start: {} | end: {}", stmt, s.start, s.end);
}
}
```
The output I get is:
```
stmt: ALTER TABLE users ADD COLUMN foo VARCHAR | start: at Line: 2, Column:
13 | end: at Line: 3, Column: 17
stmt: ALTER TABLE users ADD COLUMN bar VARCHAR | start: at Line: 8, Column:
13 | end: at Line: 8, Column: 33
stmt: SELECT 1 | start: at Line: 8, Column: 43 | end: at Line: 8, Column:
51
```
Everything seems correct to me, except of the ending line of the first
query, which I expected it to be `4` instead of `3`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]