Re: [BUGS] Timezone error when casting. Maybe daylight saving

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kjetil Nygård <polpot78(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-jdbc(at)postgresql(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: [BUGS] Timezone error when casting. Maybe daylight saving
Date: 2014-04-02 03:54:52
Message-ID: CAB7nPqQ1Cya_ixpeH+NFLjG5_fiYorBokoeyboKaTLrF76Sqxg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-jdbc

On Wed, Apr 2, 2014 at 7:43 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Kjetil =?ISO-8859-1?Q?Nyg=E5rd?= <polpot78(at)gmail(dot)com> writes:
>> I try to build with the tests, but when I run the test
>> org.postgresql.test.jdbc2.StatementTest.testDateFunctions() i get:
>> junit.framework.AssertionFailedError: expected:<-3> but was:<-2>
>
>> When I run the same function directly in PostgreSQL, I also get -2:
>
>> test=> select extract( day from ((CAST(-3 || ' day' as
>> interval)+now())-now()));
>> date_part
>> -----------
>> -2
>
> I get -3 ... unless I set my timezone to Europe/Oslo. I'm guessing
> that you had a daylight savings transition this past weekend? If so,
> the issue is that the query gives a different answer for a couple
> of days after a transition, as a consequence of the fact that adding
> '1 day' to a timestamp is not the same as adding '24 hours'.
>
> We used to have issues of this sort with the core regression tests;
> they'd fail predictably for a couple of days in spring and fall.
> Eventually we changed all the test cases to not hit the boundary
> condition ... which is arguably a loss of test coverage, but it
> wasn't worth the hassle of having unstable regression test results.
> It sounds like JDBC's test cases still have the issue.
The same question gets asked from time to time...
http://www.postgresql.org/message-id/17307.1021949260@sss.pgh.pa.us
http://www.postgresql.org/message-id/21758.1363108146@sss.pgh.pa.us
--
Michael

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2014-04-02 08:22:03 GiST does palloc's in critical section
Previous Message Tom Lane 2014-04-02 02:05:34 Re: [BUGS] BUG #9518: temporary login failure - "missing pg_hba entry"

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tomonari Katsumata 2014-04-03 08:37:38 Re: About binaryTransfer.
Previous Message Tom Lane 2014-04-01 22:43:15 Re: Timezone error when casting. Maybe daylight saving