martinmsb opened a new issue, #2221:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/2221

   ### Describe the bug
   The ClickHouseDialect parser fails to parse valid ClickHouse syntax when 
WITH clause is used declaring [scalar 
expressions](https://clickhouse.com/docs/sql-reference/statements/select/with#common-scalar-expressions).
   
   ### To Reproduce
   ```
   use sqlparser::dialect::ClickHouseDialect;
   use sqlparser::parser::Parser;
   
   fn main() {
       let sql = r#"
           WITH 42 AS answer
           SELECT answer FROM table
       "#;
       
       let dialect = ClickHouseDialect {};
       let result = Parser::parse_sql(&dialect, sql);
       println!("{:?}", result);
   }
   ```
   **Error:**
   Err(ParserError("Expected: identifier, found: 42 at Line: 2, Column: 14"))
   
   ### Expected behavior tested in ClickHouse 26.1.2.11
   The parser using ClickHouseDialect should accept the clause as ClickHouse 
does support it:
   `WITH 42 AS answer SELECT answer FROM table`
   
   ### Additional context
   The syntax from the [ClickHouse 
documentation](https://clickhouse.com/docs/sql-reference/statements/select/with#common-scalar-expressions-syntax)
 for this clause is: `WITH <expression> AS <identifier>`
   sqlparser version: 0.61


-- 
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]

Reply via email to