feat: add precision for TIME, DATETIME, and TIMESTAMP data types (#701)

Now all those statements are both parsed and displayed with precision
and timezone info. Tests were added to the ones presented in the ANSI
standard.
This commit is contained in:
Augusto Fotino 2022-11-11 18:06:57 -03:00 committed by GitHub
parent cdf4447065
commit 65c5a37bce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 108 additions and 40 deletions

View file

@ -2944,7 +2944,7 @@ fn parse_literal_time() {
let select = verified_only_select(sql);
assert_eq!(
&Expr::TypedString {
data_type: DataType::Time(TimezoneInfo::None),
data_type: DataType::Time(None, TimezoneInfo::None),
value: "01:23:34".into(),
},
expr_from_projection(only(&select.projection)),
@ -2957,7 +2957,7 @@ fn parse_literal_datetime() {
let select = verified_only_select(sql);
assert_eq!(
&Expr::TypedString {
data_type: DataType::Datetime,
data_type: DataType::Datetime(None),
value: "1999-01-01 01:23:34.45".into(),
},
expr_from_projection(only(&select.projection)),
@ -2970,7 +2970,7 @@ fn parse_literal_timestamp_without_time_zone() {
let select = verified_only_select(sql);
assert_eq!(
&Expr::TypedString {
data_type: DataType::Timestamp(TimezoneInfo::None),
data_type: DataType::Timestamp(None, TimezoneInfo::None),
value: "1999-01-01 01:23:34".into(),
},
expr_from_projection(only(&select.projection)),
@ -2985,7 +2985,7 @@ fn parse_literal_timestamp_with_time_zone() {
let select = verified_only_select(sql);
assert_eq!(
&Expr::TypedString {
data_type: DataType::Timestamp(TimezoneInfo::Tz),
data_type: DataType::Timestamp(None, TimezoneInfo::Tz),
value: "1999-01-01 01:23:34Z".into(),
},
expr_from_projection(only(&select.projection)),