Re: Two bugs found (and patch included)

Lists: pgsql-jdbc
From: "Xavier Poinsard" <xpoinsard(at)free(dot)fr>
To: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Two bugs found (and patch included)
Date: 2005-01-17 15:23:17
Message-ID: 41EBD865.20507@free.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

I just discovered two bugs and attached a patch to correct them :

- the jdbc escaped scalar function dayofweek should return values
between 1 and 7 (1 for sunday) unlike the backend "extract dow" function

- the literal escaped values for date/time/timestamp were not explicitly
casted and causing some problems : for example
extract( dow from '2005-01-17 12:00:00')
generate an error, but the following is accepted
extract( dow from TIMESTAMP '2005-01-17 12:00:00')

Xavier Poinsard.

Attachment Content-Type Size
patchDOWandTSbugs.txt text/plain 3.7 KB

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Xavier Poinsard <xpoinsard(at)free(dot)fr>
Cc: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Two bugs found (and patch included)
Date: 2005-01-18 21:36:39
Message-ID: 41ED8167.2030600@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Xavier Poinsard wrote:
> I just discovered two bugs and attached a patch to correct them :
>
> - the jdbc escaped scalar function dayofweek should return values
> between 1 and 7 (1 for sunday) unlike the backend "extract dow" function
>
> - the literal escaped values for date/time/timestamp were not explicitly
> casted and causing some problems : for example
> extract( dow from '2005-01-17 12:00:00')
> generate an error, but the following is accepted
> extract( dow from TIMESTAMP '2005-01-17 12:00:00')

Applied. Thanks for the report & patch.

While testing this patch I noticed we have existing date-related
regression failures (not related to the patch) against 7.2.x:

> [junit] Testcase: testSetTimestampWTZ(org.postgresql.test.jdbc2.TimestampTest): Caused an ERROR
> [junit] ERROR: Bad timestamp external representation '2000-02-08 04:00:00.120000+1300'
> [junit] org.postgresql.util.PSQLException: ERROR: Bad timestamp external representation '2000-02-08 04:00:00.120000+1300'
...
> [junit] at org.postgresql.test.jdbc2.TimestampTest.testSetTimestampWTZ(TimestampTest.java:100)

> [junit] Testcase: testSetTimestampWOTZ(org.postgresql.test.jdbc2.TimestampTest): Caused an ERROR
> [junit] ERROR: Bad timestamp external representation '2000-02-07 15:00:00.120000+1300'
> [junit] org.postgresql.util.PSQLException: ERROR: Bad timestamp external representation '2000-02-07 15:00:00.120000+1300'
...
> [junit] at org.postgresql.test.jdbc2.TimestampTest.testSetTimestampWOTZ(TimestampTest.java:210)

Is it worth fixing this?

-O


From: Kris Jurka <books(at)ejurka(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Two bugs found (and patch included)
Date: 2005-01-18 21:58:06
Message-ID: Pine.BSO.4.56.0501181654410.7331@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Wed, 19 Jan 2005, Oliver Jowett wrote:

> While testing this patch I noticed we have existing date-related
> regression failures (not related to the patch) against 7.2.x:
>
> Bad timestamp external representation '2000-02-08 04:00:00.120000+1300'

This appears to be an oddity of the +1300 timezone. Both of the following
work:

select '2000-02-07 15:00:00.120000+13'::timestamptz;
select '2000-02-07 15:00:00.120000+1200'::timestamptz;

We potentially could hack around this on the driver, but it looks to me
like a server problem, so I'd leave it alone based on the number of people
it affects (7.2 & +1300).

Kris Jurka


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: Xavier Poinsard <xpoinsard(at)free(dot)fr>, pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Two bugs found (and patch included)
Date: 2005-01-18 21:58:52
Message-ID: 21121.1106085532@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Oliver Jowett <oliver(at)opencloud(dot)com> writes:
> While testing this patch I noticed we have existing date-related
> regression failures (not related to the patch) against 7.2.x:

>> [junit] Testcase: testSetTimestampWTZ(org.postgresql.test.jdbc2.TimestampTest): Caused an ERROR
>> [junit] ERROR: Bad timestamp external representation '2000-02-08 04:00:00.120000+1300'

I believe this is a server bug, not JDBC's fault. The timestamp code
rejected +1300 as an invalid timezone until not too long ago. It is
valid though...

regards, tom lane