This repository was archived by the owner on Dec 25, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,10 +48,14 @@ pub enum DataType {
4848 Boolean ,
4949 /// Date
5050 Date ,
51- /// Time
51+ /// Time without time zone
5252 Time ,
53- /// Timestamp
53+ /// Time with time zone
54+ TimeTz ,
55+ /// Timestamp without time zone
5456 Timestamp ,
57+ /// Timestamp with time zone
58+ TimestampTz ,
5559 /// Interval
5660 Interval ,
5761 /// Regclass used in postgresql serial
@@ -94,7 +98,9 @@ impl fmt::Display for DataType {
9498 DataType :: Boolean => write ! ( f, "boolean" ) ,
9599 DataType :: Date => write ! ( f, "date" ) ,
96100 DataType :: Time => write ! ( f, "time" ) ,
101+ DataType :: TimeTz => write ! ( f, "time with time zone" ) ,
97102 DataType :: Timestamp => write ! ( f, "timestamp" ) ,
103+ DataType :: TimestampTz => write ! ( f, "timestamp with time zone" ) ,
98104 DataType :: Interval => write ! ( f, "interval" ) ,
99105 DataType :: Regclass => write ! ( f, "regclass" ) ,
100106 DataType :: Text => write ! ( f, "text" ) ,
Original file line number Diff line number Diff line change @@ -1541,15 +1541,19 @@ impl Parser {
15411541 "UUID" => Ok ( DataType :: Uuid ) ,
15421542 "DATE" => Ok ( DataType :: Date ) ,
15431543 "TIMESTAMP" => {
1544- // TBD: we throw away "with/without timezone" information
1545- if self . parse_keyword ( "WITH" ) || self . parse_keyword ( "WITHOUT" ) {
1544+ if self . parse_keyword ( "WITH" ) {
1545+ self . expect_keywords ( & [ "TIME" , "ZONE" ] ) ?;
1546+ return Ok ( DataType :: TimestampTz )
1547+ } else if self . parse_keyword ( "WITHOUT" ) {
15461548 self . expect_keywords ( & [ "TIME" , "ZONE" ] ) ?;
15471549 }
15481550 Ok ( DataType :: Timestamp )
15491551 }
15501552 "TIME" => {
1551- // TBD: we throw away "with/without timezone" information
1552- if self . parse_keyword ( "WITH" ) || self . parse_keyword ( "WITHOUT" ) {
1553+ if self . parse_keyword ( "WITH" ) {
1554+ self . expect_keywords ( & [ "TIME" , "ZONE" ] ) ?;
1555+ return Ok ( DataType :: TimeTz )
1556+ } else if self . parse_keyword ( "WITHOUT" ) {
15531557 self . expect_keywords ( & [ "TIME" , "ZONE" ] ) ?;
15541558 }
15551559 Ok ( DataType :: Time )
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ fn parse_create_table_with_defaults() {
3131 activebool boolean DEFAULT true NOT NULL,
3232 create_date date DEFAULT now()::text NOT NULL,
3333 last_update timestamp without time zone DEFAULT now() NOT NULL,
34+ last_update_tz timestamp with time zone,
3435 active integer NOT NULL
3536 ) WITH (fillfactor = 20, user_catalog_table = true, autovacuum_vacuum_threshold = 100)" ;
3637 match pg_and_generic ( ) . one_statement_parses_to ( sql, "" ) {
@@ -147,6 +148,12 @@ fn parse_create_table_with_defaults() {
147148 }
148149 ] ,
149150 } ,
151+ ColumnDef {
152+ name: "last_update_tz" . into( ) ,
153+ data_type: DataType :: TimestampTz ,
154+ collation: None ,
155+ options: vec![ ] ,
156+ } ,
150157 ColumnDef {
151158 name: "active" . into( ) ,
152159 data_type: DataType :: Int ,
You can’t perform that action at this time.
0 commit comments