Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WV7hH-00007a-IX for pgsql-bugs@arkaria.postgresql.org; Tue, 01 Apr 2014 23:02:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WV7Os-00046n-9b for pgsql-bugs@arkaria.postgresql.org; Tue, 01 Apr 2014 22:43:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WV7Oq-00046c-91; Tue, 01 Apr 2014 22:43:20 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WV7On-0005PR-Np; Tue, 01 Apr 2014 22:43:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s31MhGRW008363; Tue, 1 Apr 2014 18:43:16 -0400 From: Tom Lane To: Kjetil =?ISO-8859-1?Q?Nyg=E5rd?= cc: PostgreSQL mailing lists , pgsql-bugs@postgresql.org Subject: Re: Timezone error when casting. Maybe daylight saving In-reply-to: <1396383514.15479.13.camel@kjetil.kny.im> References: <1396383514.15479.13.camel@kjetil.kny.im> Comments: In-reply-to Kjetil =?ISO-8859-1?Q?Nyg=E5rd?= message dated "Tue, 01 Apr 2014 22:18:34 +0200" Date: Tue, 01 Apr 2014 18:43:15 -0400 Message-ID: <8362.1396392195@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Kjetil =?ISO-8859-1?Q?Nyg=E5rd?= 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