Re: Messed up time zones - Mailing list pgsql-admin

From Bill MacArthur
Subject Re: Messed up time zones
Date
Msg-id 501BEF7C.1030403@dhs-club.com
Whole thread Raw
In response to Re: Messed up time zones  (Laszlo Nagy <gandalf@shopzeus.com>)
Responses Re: Messed up time zones
List pgsql-admin
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
Ididn'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
tostore 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
valuesand return the timestamptz just as it was inserted. 

pgsql-admin by date:

Previous
From: Laszlo Nagy
Date:
Subject: Re: Messed up time zones
Next
From: Laszlo Nagy
Date:
Subject: Re: Messed up time zones