Re: JDBC and intervals

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Pablo Velasquez Rivas <pvelasquez(at)its(dot)co(dot)cr>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC and intervals
Date: 2004-02-09 23:52:05
Message-ID: 1076370725.1594.134.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Pablo,

OK, I played with this a bit, you can do a cast of final - initial as a
time which the driver s/b able to deal with

davec=# select (final - initial)::time as x from intvl1;
x
----------
00:00:00
(1 row)

also naming it would be helpful, but this does sound like a driver bug.

Dave

On Mon, 2004-02-09 at 16:11, Pablo Velasquez Rivas wrote:
> Hi.
>
> I'm trying to get an interval from a postgresql query.
>
> I was using jdbc for postgresql 7.3.x, and my query was:
>
> ResultSet.executeQuery("SELECT (final_date - initial_date) FROM
> some_table") ;
>
> When I did something like this:
> System.out.println(resultSet.getObject(1)), , I got the message: "
> Error = No class found for interval"
>
> So, I tried upgrating to postgresql 7.4.x, and if I do
> System.out.println(resultSet.getObject(1)) , I get : null.
>
> So, is there a way to get an interval from a postgresql query ?, or am
> I doing something wrong ??
>
>
> Thanks for any help.
> == ==
> Pablo A. Velasquez Rivas
> Computer Science Engineer
> == ==
--
Dave Cramer
519 939 0336
ICQ # 14675561

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2004-02-10 04:16:42 closing statements when connection is closed
Previous Message Oliver Jowett 2004-02-09 23:34:49 Re: Use of instanceOf