support "set time zone to 'some-timezone'" (#617)

* support "set time zone"

* fix clippy

* fix test cases
This commit is contained in:
Wei-Ting Kuo 2022-09-20 21:44:51 +08:00 committed by GitHub
parent 48fa79d744
commit fccae77c5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 1 deletions

View file

@ -3774,7 +3774,12 @@ impl<'a> Parser<'a> {
});
}
let variable = self.parse_object_name()?;
let variable = if self.parse_keywords(&[Keyword::TIME, Keyword::ZONE]) {
ObjectName(vec!["TIMEZONE".into()])
} else {
self.parse_object_name()?
};
if variable.to_string().eq_ignore_ascii_case("NAMES")
&& dialect_of!(self is MySqlDialect | GenericDialect)
{