Re: Timestamp with time zone 'negative' problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Prodan, Andrei" <Andrei(dot)Prodan(at)awinta(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Timestamp with time zone 'negative' problem
Date: 2012-01-20 15:20:50
Message-ID: 9315.1327072850@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Prodan, Andrei" <Andrei(dot)Prodan(at)awinta(dot)com> writes:
> I have a DB in which items which are 'always valid' have a from_date of
> 19000101 000000+1 (Europe/Berlin)
> When i try to restore the same DB to (Europe/Bucharest), instead of
> 19000101 000000+2, the timestamp becomes "1900-01-01 00:44:24+01:44:24"
> which is ... strange.

No, not particularly. According to the Olson timezone database,
Bucharest didn't adopt standard time (that is, an integral-hours offset
from GMT) until 1931. Before that, local midnight was true local
midnight, and they are 1:44:24 east of Greenwich, so that is what
"midnight of 1900/01/01" means in that zone.

The only reason your code fails to fail in Europe/Berlin zone is that
Berlin adopted standard time in 1893, so that midnight of 1900/01/01
is already an exact offset from GMT in that zone.

Personally, I'd suggest getting away from the magic number. Consider
using NULL or -infinity instead of an arbitrary date. Failing that,
don't use a place-based zone with all the historical baggage that
those entail, but something fixed like 'GMT+1'.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message George Younan 2012-01-20 15:47:36
Previous Message David Johnston 2012-01-20 15:00:42 Re: Immutable function with bind value