Fork me on GitHub

Btw. on the general advice to "always use UTC" - it's not always that easy:


Why I recommend always using TIMESTAMPTZ over TIMESTAMP is that I think this is dangerous:

INSERT INTO dummy.ts_test(ts, ts_tz)
VALUES ('2019-06-06T11:48:51.133+08', '2019-06-06T11:48:51.133+08');

SELECT * FROM dummy.ts_test;
           ts            |           ts_tz
 2019-06-06 11:48:51.133 | 2019-06-06 03:48:51.133+00
(1 row)
Postgres happily accepts value 2019-06-06T11:48:51.133+08 for TIMESTAMP field and just ignores the +08 which could lead to interesting results.


And yes, probably just “always use UTC” is not enough for all edge-cases but it’s the most sane approach I’ve encountered so far. 🙂

👍 4