Re: anyone know why this is failing

From: Kris Jurka <books(at)ejurka(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: anyone know why this is failing
Date: 2004-02-11 03:31:38
Message-ID: Pine.LNX.4.33.0402102225270.26959-100000@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

> ResultSet rs = pstmt.executeQuery("select (final-initial) as diff
> from test_interval");
> while (rs.next() )
> {
> String str = (String)rs.getString(1);
>
> assertNotNull(str);
> str = (String)rs.getObject(1);
> assertNotNull(str);
> }
> }

The difference of two timestamps is an interval, a type which has no
equivalent Java class. The driver tries to determine a custom class
mapping (like those for the geometry types) in

AbstractJdbc1Connection.getObject(String type, String value)

which has a bug in it. I'm not sure I agree with your expectation that it
return a String, but that is certainly a position which could be argued.
I would have expected this to throw an Exception indicating that it
couldn't determine what to do with it. Another option would be to provide
a PGInterval class and map it appropriately.

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ian Clarito 2004-02-11 09:08:15 unsubscribe
Previous Message wsmeyer 2004-02-11 02:05:03 unsubscribe