Support expression in AT TIME ZONE and fix precedence (#1272)

This commit is contained in:
Joey Hain 2024-05-23 10:30:05 -07:00 committed by GitHub
parent 9d15f7e9a9
commit d5faf3c54b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 65 additions and 53 deletions

View file

@ -584,7 +584,7 @@ pub enum Expr {
/// AT a timestamp to a different timezone e.g. `FROM_UNIXTIME(0) AT TIME ZONE 'UTC-06:00'`
AtTimeZone {
timestamp: Box<Expr>,
time_zone: String,
time_zone: Box<Expr>,
},
/// Extract a field from a timestamp e.g. `EXTRACT(MONTH FROM foo)`
///
@ -1270,7 +1270,7 @@ impl fmt::Display for Expr {
timestamp,
time_zone,
} => {
write!(f, "{timestamp} AT TIME ZONE '{time_zone}'")
write!(f, "{timestamp} AT TIME ZONE {time_zone}")
}
Expr::Interval(interval) => {
write!(f, "{interval}")