mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-09 21:42:05 +00:00
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:
parent
cdf4447065
commit
65c5a37bce
5 changed files with 108 additions and 40 deletions
|
@ -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)),
|
||||
|
|
|
@ -1026,7 +1026,7 @@ fn parse_table_colum_option_on_update() {
|
|||
assert_eq!(
|
||||
vec![ColumnDef {
|
||||
name: Ident::with_quote('`', "modification_time"),
|
||||
data_type: DataType::Datetime,
|
||||
data_type: DataType::Datetime(None),
|
||||
collation: None,
|
||||
options: vec![ColumnOptionDef {
|
||||
name: None,
|
||||
|
|
|
@ -227,7 +227,7 @@ fn parse_create_table_with_defaults() {
|
|||
},
|
||||
ColumnDef {
|
||||
name: "last_update".into(),
|
||||
data_type: DataType::Timestamp(TimezoneInfo::WithoutTimeZone),
|
||||
data_type: DataType::Timestamp(None, TimezoneInfo::WithoutTimeZone),
|
||||
collation: None,
|
||||
options: vec![
|
||||
ColumnOptionDef {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue