Issues with Array interface?

From: Noel Rappin <nrappin(at)sockeye(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Issues with Array interface?
Date: 2002-05-30 15:10:30
Message-ID: 3CF640E6.6040201@sockeye.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I'm having some problems with the Array interface in 7.2, and I'm
wondering if somebody can point me to a workaround.

Issue 1:

The array in the database is of type real[]. The code:

Array dataArray = rs.getArray("value");
Float[] data = (Float[]) dataArray.getArray();

gives me a class cast exception. This seems to be true no matter what I
try to cast the array to (even Object[]), When I work around by using
dataArray.getResultSet(), it correctly casts the individual elements of
the result to Float. I have an analagous problem when the array is of
type smallint. Since I can work around this with the result set, it's
less of a problem, but it is strange.

Issue 2:

The array in the database is of type timestamp with time zone [].

Array timeArray = rs.getArray("time");
Timestamp[] times = (Timestamp[]) timeArray.getArray();

runs without a class cast exception, however every element in the array
is set to the same value -- the value that would be at times[0]. This
problem persists even if I use getResultSet() -- even when I next()
through the array, the data value does not change. I can't seem to
access the later values in the array at all.

Has anybody else seen this problem? Any suggestions for workarounds?
The data can be accessed correctly through psql, so I believe the
problem must be in the driver.

Thanks,

Noel Rappin

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2002-05-30 15:20:23 Re: Issues with Array interface?
Previous Message Dave Cramer 2002-05-30 14:59:24 Re: Doubt more info