You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It was normal to parse "SET TIME ZONE 'UTC'" a few days ago. Today I tried to parse "SET TIME ZONE 'UTC'" and there was an error.
pub fn sql_parse_test() {
use sqlparser::dialect::GenericDialect;
use sqlparser::parser::Parser;
let sql = r#"set time zone 'UTC'"#;
let dialect = GenericDialect {};
let ast = Parser::parse_sql(&dialect, sql).unwrap();
println!("AST: {:?}", ast);
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_sql_parse() {
sql_parse_test();
}
}
called `Result::unwrap()` on an `Err` value: ParserError("Expected equals sign or TO, found: zone")
thread 'func::sql_parse_test::tests::test_sql_parse' panicked at 'called `Result::unwrap()` on an `Err` value: ParserError("Expected equals sign or TO, found: zone")', src\func\sql_parse_test.rs:9:48
Reopened -- I think the typical strategy in these cases is to reflect the difference between SET TIME ZONE = 'UTC'
and SET TIME ZONE 'UTC' in the ast and then downstream systems can figure out if they want to treat them equivalently or not
Activity
waitingkuo commentedon Sep 19, 2022
@435201823 which sqlparser version did you use that worked? i switched back to 0.5.0 but it still not works
step-baby commentedon Nov 25, 2022
The latest version of sqlparse still fails to parse SET TIME ZONE 'UTC'
waitingkuo commentedon Nov 25, 2022
@alamb i think we could reopen this and discuss.
We only support
SET TIME ZONE TO 'UTC'andSET TIME ZONE = 'UTC'but not
SET TIME ZONE 'UTC'i'm not familiar with how other db works, in postgrseql, TIMEZONE is the only variable that support
SET SOMETHING 'VALUE'https://www.postgresql.org/docs/current/sql-set.html
alamb commentedon Nov 27, 2022
Reopened -- I think the typical strategy in these cases is to reflect the difference between
SET TIME ZONE = 'UTC'and
SET TIME ZONE 'UTC'in the ast and then downstream systems can figure out if they want to treat them equivalently or notwaitingkuo commentedon Nov 28, 2022
@alamb i updated the pr