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

From: Marek Lewczuk <newsy(at)lewczuk(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: patch - support for multi-dimensional arrays and NULL values
Date: 2007-07-16 06:34:40
Message-ID: 469B1180.4030305@lewczuk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Kris Jurka pisze:
> I gave this a read and have some comments:
>
> 1) Your null checking needs to be version dependent. Releases prior to
> 8.2 do not support null elements and you'll get:
>
> # select array['a','NULL'];
> array
> ----------
> {a,NULL}
> (1 row)
Right, I will fix that.

> 2) Changing from returning arrays of primitive types to arrays of
> objects is necessary for null and multi-dimension support, but will
> still break users code all over the place. Not sure what we can do
> about that other than put a strong warning in the release notes.
For sure BC is important issue and maybe I should check PG version and
if it is < 8.2 then primitive arrays should be returned (just like
before - it needs only more code, but won't break current applications) ?

> 3) A lot of the code doesn't look like it handles multiple dimensions.
> What about things like fillIntegerResultSet? No that we're dealing with
> objects can't we abstract a lot of these copies away and provide one
> implementation that is multi-dimension aware? If you do
> Array.getResultSet you should be able to call ResultSet.getArray and the
> getResultSet on that, right?
Currently my patch applies only to java.sql.Array.getArray() and because
I didn't know what is your opinion about my implementation I didn't
patch any other methods (like java.sql.Array.getResultSet()). If you say
that my implementation + fixes proposed above are OK then I will make a
patch for other methods in order to provide full support of
java.sql.Array. Methods from AbstractJdbc2Array (like
fillIntegerResultSet()) either will be removed or fixed in order to work
with all those changes.

Best wishes,
Marek

In response to

Browse pgsql-jdbc by date

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