Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 988169066CF for ; Thu, 7 Jun 2012 15:57:04 -0300 (ADT) Received: from nblzone-228-244.nblnetworks.fi ([83.145.228.244] helo=mist.reliabit.fi) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SchtC-0006m4-Fq for pgsql-bugs@postgresql.org; Thu, 07 Jun 2012 18:57:03 +0000 Received: from [192.168.31.235] (hoasnet-fe31dd00-89.dhcp.inet.fi [80.221.49.89]) by mist.reliabit.fi (Postfix) with ESMTPSA id 21569164ED3; Thu, 7 Jun 2012 21:56:43 +0300 (EEST) Message-ID: <4FD0F96A.80301@reliabit.fi> Date: Thu, 07 Jun 2012 21:56:42 +0300 From: =?ISO-8859-1?Q?Kasper_R=F6nning?= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.4) Gecko/20120421 Thunderbird/10.0.4 MIME-Version: 1.0 To: Tom Lane CC: pgsql-bugs@postgresql.org Subject: Re: Issue when displaying TIMESTAMPTZ values References: <4FD0B1C4.7040307@reliabit.fi> <8593.1339079838@sss.pgh.pa.us> In-Reply-To: <8593.1339079838@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/56 X-Sequence-Number: 33283 Hi, Thank you for the quick reply! I was completely unaware of the old time=20 zones of Helsinki! However I'm afraid that the behaviour of Postgresql=20 seems plain wrong to me. An example: SET TIME ZONE 'Europe/Helsinki'; DROP TABLE IF EXISTS test1; CREATE TABLE test1 (ts TIMESTAMPTZ); INSERT INTO test1 VALUES ('0001-01-01 00:00:00'); SELECT * FROM test1; -- ts -- ------------------------------ -- 0001-01-01 00:00:00+01:39:52 Here I enter a timestamp in Helsinki time zone, and the query result is=20 different, even though the time zone is the same. I will resolve this matter by using TIMESTAMP WITHOUT TIME ZONE instead,=20 and storing the offset manually. That way I get two advantages: 1)=20 queried time stamp will be equal to the inserted one 2) time offset=20 information is stored, allowing the time to be displayed in the same=20 time zone as it was entered and at the point in time that it was entered. Best regards, Kasper R=F6nning On 7.6.2012 17:37, Tom Lane wrote: > =3D?ISO-8859-1?Q?Kasper_R=3DF6nning?=3D wr= ites: >> I seem to have found a bug in Postgres 9.1.3. Apparently timestamp >> values are stored correctly in the database, but querying it returns >> invalid results. My environment is Windows 7 64bit. The unexpected >> result is that timestamps before 1st of May 1921 are displayed >> incorrectly when time zone is 'Europe/Helsinki'. > This is not incorrect. The Olson timezone database shows: > > # Zone NAME GMTOFF RULES FORMAT [UNTIL] > Zone Europe/Helsinki 1:39:52 - LMT 1878 May 31 > 1:39:52 - HMT 1921 May # Helsinki Mean Time > 2:00 Finland EE%sT 1983 > 2:00 EU EE%sT > > that is, it was only in 1921 that Helsinki adopted "standard" time > referenced to the Greenwich meridian. Before that it would have been > typical to set clocks by local mean solar time, which is 1:39:52 east > of Greenwich. > > regards, tom lane --=20 Kasper R=F6nning Reliabit Ay www.reliabit.fi kasper.ronning@reliabit.fi Tel: +358-445 010 634