Re: Daylight savings time confusion

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Rob Richardson <Rob(dot)Richardson(at)rad-con(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Daylight savings time confusion
Date: 2010-03-16 15:11:59
Message-ID: 20100316151159.GD3037@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:

> If my guesses are correct, then the minimum change to avoid this type
> of problem in the future is to change UTCTimestamp to be declared as
> timestamp WITHOUT time zone, so that you don't get two extra zone
> rotations in there. However, I would strongly suggest that you rethink
> how you're storing the data altogether. Two columns that represent the
> identical item of information is not good database design according to
> any theory I've ever heard. What I'd store is a single fire_date column
> that is of type timestamp with time zone and is just assigned directly
> from current_timestamp without any funny business. Internally it is UTC
> and completely unambiguous. Subsequently you can read it out in any
> time zone you want, either by setting TimeZone appropriately or by using
> the AT TIME ZONE construct to do a one-time conversion.

And possibly store the original timezone as a separate column, if that
information is of any value.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Manlio Perillo 2010-03-16 15:14:43 Re: restoring a database to its initial state
Previous Message Arnaud Lesauvage 2010-03-16 15:11:05 Re: UPDATE with JOIN not using index