You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "agis (via GitHub)" <gi...@apache.org> on 2025/05/22 19:53:21 UTC

[I] Incorrect `Spanned.end` value in multi-line query [datafusion-sqlparser-rs]

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: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Postgres: Incorrect ending line reported in `Span` for multi-line query [datafusion-sqlparser-rs]

Posted by "iffyio (via GitHub)" <gi...@apache.org>.
iffyio closed issue #1858: Postgres: Incorrect ending line reported in `Span` for multi-line query
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/1858


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org