Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WV58u-0002IA-BD for pgsql-bugs@arkaria.postgresql.org; Tue, 01 Apr 2014 20:18:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WV58t-0002wD-RA for pgsql-bugs@arkaria.postgresql.org; Tue, 01 Apr 2014 20:18:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WV58t-0002w3-7l; Tue, 01 Apr 2014 20:18:43 +0000 Received: from mail-lb0-x230.google.com ([2a00:1450:4010:c04::230]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WV58p-0002iF-TF; Tue, 01 Apr 2014 20:18:42 +0000 Received: by mail-lb0-f176.google.com with SMTP id 10so7394845lbg.35 for ; Tue, 01 Apr 2014 13:18:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:content-type:mime-version :content-transfer-encoding; bh=++q46yh/USNSoT775il99LrKYTGcoOpAofO6lwCcUDo=; b=aXa9QnorcUi0xzz0XUo0kW4inmPhfWUIXuBoCxHEfSkhdzQdWH9y+RFsoLbXIN/Ols U2OYqkKdvuAl/yrFc/3Su+BoztHtbor8pj1Uusok0b0zqSMqf81suuTj5sr2y48ur5Sc R29Sr9ma83ZsmIv02i8mCTMic849BLOyKZJtQaohFKfhAr+njpQ+29/3sU088EFsEmCq WjHLsK98p0WZdaeGQse1QQfkP1vFdla8jIfitYeZPy/NIuDY8cUoQTvlrqBywZZWK5Ir 22pXoOwQAHMQ7WeRQ2K54789e1ayz0wkorBZ21NjJrc5uF+JpgoiXvx8HAzcViTnPAzs +s/A== X-Received: by 10.112.47.3 with SMTP id z3mr2602760lbm.34.1396383517536; Tue, 01 Apr 2014 13:18:37 -0700 (PDT) Received: from [172.16.0.2] (6.85-200-22.bkkb.no. [85.200.22.6]) by mx.google.com with ESMTPSA id z10sm12811236lbu.1.2014.04.01.13.18.35 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 01 Apr 2014 13:18:36 -0700 (PDT) Message-ID: <1396383514.15479.13.camel@kjetil.kny.im> Subject: Timezone error when casting. Maybe daylight saving From: Kjetil =?ISO-8859-1?Q?Nyg=E5rd?= To: PostgreSQL mailing lists , pgsql-bugs@postgresql.org Date: Tue, 01 Apr 2014 22:18:34 +0200 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4 (3.10.4-2.fc20) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -1.8 (-) 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 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 When I remove the extract day from the expression, I get: test=> select CAST(-3 || ' day' as interval)+now()-now(); ?column? ------------------- -2 days -23:00:00 Also note these two: test=> select '3 day'::interval + now(); ?column? ------------------------------- 2014-04-04 22:13:36.144756+02 test=> select (CAST(-3 || ' days' as interval)+now()); ?column? ------------------------------- 2014-03-29 22:13:38.880739+01 Which should give the same timezone, but they are in +01 and +02. This seems like a timezone problem, but I do not yet fully understand why. My timezone is "Europe/Oslo". My PostgreSQL version is 9.3.4, from PostgreSQL's YUM-repo. PS: I sent this to both bugs and pgjdbc as it is a bug in PostgreSQL and affects pgjdbc. Regards, Kjetil Nygård Phone: +47 41 47 43 37 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs