Re: storing TZ along timestamps

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: storing TZ along timestamps
Date: 2011-07-18 22:37:15
Message-ID: 4E24B59B.5020909@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jim,

> Right; you need a timestamp and you need to know what timezone that timestamp was entered in. That means you can always convert that time to whatever timezone you'd like (like timestamptz), but you also know what time was originally entered, and what timezone it was entered in. Technically you can do that with a separate field, but that seems really ugly to me.

I disagree. It's a good mapping of the actual data.

The timestamp and the timezone in which that timestamp was entered are
two separate pieces of data and *ought* to be in two separate fields.
For one thing, the question of "what timezone was this entered in" is an
application-specific question, since you have three different potential
timezones:

* the actual client timezone
* the actual server timezone
* the application timezone if the application has configurable timezones

In a builtin data type, which of those three would you pick? Only the
application knows.

Additionally, if you have your timestamp-with-original-timezone data
type, then you're going to need to recode every single
timestamp-handling function and operator to handle the new type.

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Florian Pflug 2011-07-18 22:50:27 Re: Commitfest Status: Sudden Death Overtime
Previous Message Jim Nasby 2011-07-18 22:29:51 Re: storing TZ along timestamps