Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wouldn't go so far as to say the timestamp types are broken, just confusingly named. `timestamp with time zone` signifies an absolute point in time; `timestamp without time zone` signifies a timestamp relative to some unspecified time zone (which you must store separately, as you point out). The builtin functions universally adhere to these semantics.

E.g., when you do store the timezone separately, use `timestamp without time zone`: `time AT TIME ZONE timezone` [1] only does the right thing (i.e., interpreting `time` as relative to `timezone`, and producing an absolute time corresponding to it) if `time` is `without time zone`. (If `time` is `with time zone`, it produces the local time corresponding to the absolute time `time`, which is mathematically exactly the opposite of what you want.)

[1] https://www.postgresql.org/docs/current/functions-datetime.h...



I said they are crippled, not broken.

Unfortunately the poor naming is a big faux pas.

I really really expected timestamp with time zone to store the time zone.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: