Make time/timestamp tests fair for binary transfers - Mailing list pgsql-jdbc

From Mikko Tiihonen
Subject Make time/timestamp tests fair for binary transfers
Date
Msg-id 1185213747.1632.116.camel@dual.local
Whole thread Raw
Responses Re: Make time/timestamp tests fair for binary transfers  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc
Hi,

The main purpose of the following patch is to make TimezoneTest fair
for binary transfers. The modified test cases now work both on text and
binary protocol (I'll post my new version of it soonish after I have
resolved all remaining unit test case failures).

The patch also alters what kind of java.sql.Time values are returned.
Before the patch the millisecond value of a ResultSet.getTime could be
between -24h<x<24h. The patch changes the returned value to be always
between 0h<=x<24h. If someone thinks this change is not acceptable I'll
go back and revert it re-fix the test cases to match.

The TimeTest was only altered because of the Time millisecond value
adjustments.

The TimezoneTest has a larger alteration. Previously the code did not
mostly test the parsing of time/date/timestamp values but instead
compared the values returned by ResultSet.getString, which are
formatted by the server.
The patched version does now two checks.
1) adds a new verify round that ensures that the insert was correct by
doing an explicit query with UTC timezone and casting all values to
varchar so that the server will format them.
2) Changes all other tests to use the getTime/getDate/getTimestamp
methods when comparing if the queried data is correct.

This basically means that the getString of a time type column is now
undefined and can change. But I think it's not a problem because
different server versions have had different string representation of
time already.

Attachment

pgsql-jdbc by date:

Previous
From: Mikko Tiihonen
Date:
Subject: Fix database metadata tuple copying to work with binary data
Next
From: Oliver Jowett
Date:
Subject: Re: Make time/timestamp tests fair for binary transfers