mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-31 11:17:23 +00:00
support "set time zone to 'some-timezone'" (#617)
* support "set time zone" * fix clippy * fix test cases
This commit is contained in:
parent
48fa79d744
commit
fccae77c5e
2 changed files with 52 additions and 1 deletions
|
@ -4663,6 +4663,52 @@ fn parse_set_transaction() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_set_variable() {
|
||||
match verified_stmt("SET SOMETHING = '1'") {
|
||||
Statement::SetVariable {
|
||||
local,
|
||||
hivevar,
|
||||
variable,
|
||||
value,
|
||||
} => {
|
||||
assert!(!local);
|
||||
assert!(!hivevar);
|
||||
assert_eq!(variable, ObjectName(vec!["SOMETHING".into()]));
|
||||
assert_eq!(
|
||||
value,
|
||||
vec![Expr::Value(Value::SingleQuotedString("1".into()))]
|
||||
);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
one_statement_parses_to("SET SOMETHING TO '1'", "SET SOMETHING = '1'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_set_time_zone() {
|
||||
match verified_stmt("SET TIMEZONE = 'UTC'") {
|
||||
Statement::SetVariable {
|
||||
local,
|
||||
hivevar,
|
||||
variable,
|
||||
value,
|
||||
} => {
|
||||
assert!(!local);
|
||||
assert!(!hivevar);
|
||||
assert_eq!(variable, ObjectName(vec!["TIMEZONE".into()]));
|
||||
assert_eq!(
|
||||
value,
|
||||
vec![Expr::Value(Value::SingleQuotedString("UTC".into()))]
|
||||
);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
one_statement_parses_to("SET TIME ZONE TO 'UTC'", "SET TIMEZONE = 'UTC'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_commit() {
|
||||
match verified_stmt("COMMIT") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue