Make time/timestamp tests fair for binary transfers

From: Mikko Tiihonen <mikko(dot)tiihonen(at)iki(dot)fi>
To: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Make time/timestamp tests fair for binary transfers
Date: 2007-07-23 18:02:27
Message-ID: 1185213747.1632.116.camel@dual.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
timetest-fixes.patch text/x-patch 26.8 KB

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2007-07-23 22:30:35 Re: Make time/timestamp tests fair for binary transfers
Previous Message Dave Cramer 2007-07-23 15:55:32 Re: Problem with ResultSet retrieved with SELECT * FROM pg_indexes WHERE tablename