Re: Timezone error when casting. Maybe daylight saving

From: Kjetil Nygård <polpot78(at)gmail(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: PostgreSQL mailing lists <pgsql-jdbc(at)postgresql(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Timezone error when casting. Maybe daylight saving
Date: 2014-04-01 20:53:57
Message-ID: CAPRWLAwxnOWKe54VUq00tNdOAGRYqEdiQf_OxczM0TfXU1=5+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-jdbc

Only that it breaks a test in pgjdbc project.

But the real bug is in PostgreSQL.
1. apr. 2014 22:44 skrev "Dave Cramer" <pg(at)fastcrypt(dot)com> følgende:

> Not sure what this has to do with JDBC ?
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
>
> On Tue, Apr 1, 2014 at 4:18 PM, Kjetil Nygård <polpot78(at)gmail(dot)com> wrote:
>
>>
>> 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-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-jdbc
>>
>
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard DeVenezia 2014-04-01 21:51:01 postgresql-9.3.4-1-windows-x64 installer - Problem with strong passwords
Previous Message Dave Cramer 2014-04-01 20:44:33 Re: [JDBC] Timezone error when casting. Maybe daylight saving

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2014-04-01 22:43:15 Re: Timezone error when casting. Maybe daylight saving
Previous Message Dave Cramer 2014-04-01 20:44:33 Re: [JDBC] Timezone error when casting. Maybe daylight saving