timestamptz (with time zone) stores the times without time zone (in UTC), on the rationale that 'with time zone' means each read/write of that column will have a user supplied time zone..
Timestampz discards the timezone and converts to utc, meaning it is a destructible operation — you cannot bring back the original.
This may be important in many cases: for example antifraud where you want to store also what was literally on the user’s clock (including timezone) and show it later in reports and what have you
> I agree that the MSSQL timezoneoffset approach is the best.
It is not. A static offset is largely equivalent to a utc timestamp, and thus useless for any consideration of future event.
If you’re concerned about the limited historical and auditing value, it’s not exactly difficult to just tack that information on in a second column, or create a custom type which you can even call datetimeoffset but hanging the entire thing on that edge case is nonsense.
Hell, if you’re concerned about auditing events or fraud control you want a ton more data than just a timezone offset advertised by the client, and storing an entire timestamp just to keep that datum around is an unnecessary waste.
Replies (1)
This may be important in many cases: for example antifraud where you want to store also what was literally on the user’s clock (including timezone) and show it later in reports and what have you
Replies (2)
However the Postgres (and others) work-around is simply to add a LocalTimeZone field where necessary.
Yeah, it's not as convenient, but it's a simple, effective, work-around.
For me, this isn't the killer-app distinction that suggests choosing MSSQL over Postgres.
Replies (1)
It is not. A static offset is largely equivalent to a utc timestamp, and thus useless for any consideration of future event.
If you’re concerned about the limited historical and auditing value, it’s not exactly difficult to just tack that information on in a second column, or create a custom type which you can even call datetimeoffset but hanging the entire thing on that edge case is nonsense.
Hell, if you’re concerned about auditing events or fraud control you want a ton more data than just a timezone offset advertised by the client, and storing an entire timestamp just to keep that datum around is an unnecessary waste.