Re: patch - support for multi-dimensional arrays and NULL values

From: Marek Lewczuk <newsy(at)lewczuk(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: Kris Jurka <books(at)ejurka(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: patch - support for multi-dimensional arrays and NULL values
Date: 2007-07-16 07:41:11
Message-ID: 469B2117.2010504@lewczuk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2007-07-16 08:13:33 Re: patch - support for multi-dimensional arrays and NULL values
Previous Message Kalle Hallivuori 2007-07-16 07:15:34 Re: Stream Copy for 8.1 - 8.3dev