Re: Messed up time zones

From: Bill MacArthur <webmaster(at)dhs-club(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Messed up time zones
Date: 2012-08-03 15:34:20
Message-ID: 501BEF7C.1030403@dhs-club.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-performance

On 8/3/2012 11:23 AM, Laszlo Nagy wrote:
>> I suspect that you have not correctly internalized what timestamptz
>> values actually are. Internally they are just time values specified in
>> UTC (or UT1 if you want to be picky). On input, the value is rotated
>> from whatever zone is specified in the string (or implicitly specified
>> by "timezone") to UTC. On output, the value is rotated from UTC to
>> whatever the current "timezone" setting is.
> Oh I see. So actually they don't store the zone? I have seen that timestamptz and timestamp both occupy 8 bytes, but I didn't understand completely.
>
> It also means that if I want to store the actual time zone (in what the value was originally recorded), then I have to store the zone in a separate field. Later I can convert back to the original time zone, but only with an external program.
>
> Fine with me. I'm happy with this, just I did not understand how it works.

You could store the zone in a separate field and then create a VIEW on the table that used a function to take both values and return the timestamptz just as it was inserted.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Laszlo Nagy 2012-08-03 16:06:38 Re: Messed up time zones
Previous Message Laszlo Nagy 2012-08-03 15:23:51 Re: Messed up time zones

Browse pgsql-performance by date

  From Date Subject
Next Message Russell Keane 2012-08-03 15:57:50 Re: query using incorrect index
Previous Message Laszlo Nagy 2012-08-03 15:23:51 Re: Messed up time zones