Clarifying "timestamp with time zone"

From: Jeremy Finzel <finzelj(at)gmail(dot)com>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Clarifying "timestamp with time zone"
Date: 2018-06-15 19:24:08
Message-ID: CAMa1XUh2LTa7RFU_4ximPuu+tw8DCmW545-E7kJWJH6mnkM_BA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello!

We often prefer to use timestamptz or "timestamp with time zone" in our
environment because of its actually storing "objective time" with respect
to UTC. But in my own work experience, I have scarcely encountered a case
where business users, and software engineers, do not actually think it
means the opposite.

When I say "timestamp with time zone", people think the data is saved *in*
a specific time zone, whereas in reality, the opposite is true. It is
really more like "timestamp UTC" or you even could say "timestamp at UTC".
When you query this of course, then it shows you the time offset based on
your client timezone setting.

I do believe this is part of the SQL standard, but I have found that it
creates great confusion. I think many devs choose timestamp instead of
timestamptz because they don't really understand that timestamptz gives you
UTC time storage built-in.

That of course means that if you have multiple servers that run in a
different time zone, and you want to replicate that data to a centralized
location, you can easily figure out what objective time a record changed,
for instance, not knowing anything about what time zone the source system
is in.

So it seems to me that "timestamp with time zone" is a misnomer in a big
way, and perhaps it's worth at least clarifying the docs about this, or
even renaming the type or providing an aliased type that means the same
thing, something like timestamputc. Maybe I'm crazy but I would appreciate
any feedback on this and how easily it confuses.

Thanks,
Jeremy

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2018-06-15 19:36:10 Re: Clarifying "timestamp with time zone"
Previous Message Jeremy Finzel 2018-06-15 16:59:10 Re: Partitioning with range types