pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kjetil Nygård <polpot78@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-jdbc@postgresql.org>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Timezone error when casting. Maybe daylight saving
Date: Tue, 01 Apr 2014 18:43:15 -0400
Message-ID: <8362.1396392195@sss.pgh.pa.us> (raw)
In-Reply-To: <1396383514.15479.13.camel@kjetil.kny.im>
References: <1396383514.15479.13.camel@kjetil.kny.im>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Kjetil =?ISO-8859-1?Q?Nyg=E5rd?= <polpot78@gmail.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.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (5+ messages)  latest in thread

Message-ID: <8362.1396392195@sss.pgh.pa.us>
Permalink:  ../8362.1396392195@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8362.1396392195@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: tgl@sss.pgh.pa.us, polpot78@gmail.com, pgsql-bugs@postgresql.org
  Subject: Re: Timezone error when casting. Maybe daylight saving
  In-Reply-To: <8362.1396392195@sss.pgh.pa.us>
  References: <1396383514.15479.13.camel@kjetil.kny.im> <8362.1396392195@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox