Re: Postgres and timezones - Mailing list pgsql-general

From Vik Fearing
Subject Re: Postgres and timezones
Date
Msg-id 569FDDD0.7020106@2ndquadrant.fr
Whole thread Raw
In response to Re: Postgres and timezones  (Steve Rogerson <steve.pg@yewtc.demon.co.uk>)
Responses Re: Postgres and timezones
List pgsql-general
On 01/20/2016 04:24 PM, Steve Rogerson wrote:
>> Postgres doesn't store original TZ. It does recalculation to local TZ. If you
>> need original TZ, you have to store it separetely.
>>
>
> I know and that's what I'm trying to deal with. Given I know the origin TZ  -
> as in Europe/Lisbon I'm trying to determine the short name so I can store it.

I would recommend against storing the abbreviation.  The abbreviations
are not globally unique and don't follow daylight savings.  If you want
to store the original time zone, I would use the full name.

Something like this might be relative to your interests:

    INSERT INTO tbl (ts, tz)
    VALUES ('2016-01-20 00:00', current_setting('TimeZone'));

This will do the right thing regardless of where the client is (unless
it's set to "localtime" and then it's useless).
--
Vik Fearing                                          +33 6 46 75 15 36
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


pgsql-general by date:

Previous
From: Simon Riggs
Date:
Subject: Re: CoC [Final]
Next
From: David Grelaud
Date:
Subject: Re: Why PG uses nested-loop join when no indexes are available?