File tree 4 files changed +18
-0
lines changed
4 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ pub enum DataType {
71
71
Date ,
72
72
/// Time
73
73
Time ,
74
+ /// Datetime
75
+ Datetime ,
74
76
/// Timestamp
75
77
Timestamp ,
76
78
/// Interval
@@ -143,6 +145,7 @@ impl fmt::Display for DataType {
143
145
DataType :: Boolean => write ! ( f, "BOOLEAN" ) ,
144
146
DataType :: Date => write ! ( f, "DATE" ) ,
145
147
DataType :: Time => write ! ( f, "TIME" ) ,
148
+ DataType :: Datetime => write ! ( f, "DATETIME" ) ,
146
149
DataType :: Timestamp => write ! ( f, "TIMESTAMP" ) ,
147
150
DataType :: Interval => write ! ( f, "INTERVAL" ) ,
148
151
DataType :: Regclass => write ! ( f, "REGCLASS" ) ,
Original file line number Diff line number Diff line change @@ -169,6 +169,7 @@ define_keywords!(
169
169
DATA ,
170
170
DATABASE ,
171
171
DATE ,
172
+ DATETIME ,
172
173
DAY ,
173
174
DEALLOCATE ,
174
175
DEC ,
Original file line number Diff line number Diff line change @@ -2733,6 +2733,7 @@ impl<'a> Parser<'a> {
2733
2733
}
2734
2734
Keyword :: UUID => Ok ( DataType :: Uuid ) ,
2735
2735
Keyword :: DATE => Ok ( DataType :: Date ) ,
2736
+ Keyword :: DATETIME => Ok ( DataType :: Datetime ) ,
2736
2737
Keyword :: TIMESTAMP => {
2737
2738
// TBD: we throw away "with/without timezone" information
2738
2739
if self . parse_keyword ( Keyword :: WITH ) || self . parse_keyword ( Keyword :: WITHOUT ) {
Original file line number Diff line number Diff line change @@ -2615,6 +2615,19 @@ fn parse_literal_time() {
2615
2615
) ;
2616
2616
}
2617
2617
2618
+ #[ test]
2619
+ fn parse_literal_datetime ( ) {
2620
+ let sql = "SELECT DATETIME '1999-01-01 01:23:34.45'" ;
2621
+ let select = verified_only_select ( sql) ;
2622
+ assert_eq ! (
2623
+ & Expr :: TypedString {
2624
+ data_type: DataType :: Datetime ,
2625
+ value: "1999-01-01 01:23:34.45" . into( )
2626
+ } ,
2627
+ expr_from_projection( only( & select. projection) ) ,
2628
+ ) ;
2629
+ }
2630
+
2618
2631
#[ test]
2619
2632
fn parse_literal_timestamp ( ) {
2620
2633
let sql = "SELECT TIMESTAMP '1999-01-01 01:23:34'" ;
You can’t perform that action at this time.
0 commit comments