Re: patch - support for multi-dimensional arrays and NULL values - Mailing list pgsql-jdbc

From Marek Lewczuk
Subject Re: patch - support for multi-dimensional arrays and NULL values
Date
Msg-id 469B2117.2010504@lewczuk.com
Whole thread Raw
In response to Re: patch - support for multi-dimensional arrays and NULL values  (Oliver Jowett <oliver@opencloud.com>)
Responses Re: patch - support for multi-dimensional arrays and NULL values
List pgsql-jdbc
Oliver Jowett pisze:
> I was wondering which behaviour was right -- I thought returning
> array-of-primitive was correct per the spec at the time I wrote it, and
> that's why getArray() returns Object not Object[] -- but now the 1.6
> javadoc says:
>
>> Note: When getArray is used to materialize a base type that maps to a
>> primitive data type, then it is implementation-defined whether the
>> array returned is an array of that primitive data type or an array of
>> Object.
>
> So I suppose that .. in theory .. applications should be expecting to
> handle both. Ugh.
My opinion is that we should keep BC either by building two different
jdbc versions or checking PG version every time getArray() is used (if <
8.2 then primitive types are used, if >= 8.2 then objects). Second
option is quite good, although it doesn't guaranty full BC - let assume
that someone is using jdbc application that was written for pg 8.0, but
after update to 8.2 the code with following statement:
<code>(boolean[]) getArray()</code>
would cause cast exception (Cannot cast from Boolean[] to boolean[]).

Regards,
ML





pgsql-jdbc by date:

Previous
From: "Kalle Hallivuori"
Date:
Subject: Re: Stream Copy for 8.1 - 8.3dev
Next
From: Oliver Jowett
Date:
Subject: Re: patch - support for multi-dimensional arrays and NULL values