Re: UDT arrays

From: Lukas Eder <lukas(dot)eder(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: UDT arrays
Date: 2011-02-23 21:45:28
Message-ID: 3a2e9872-dfd2-48ea-94d8-6cc72b3d5a28@x13g2000vbe.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Feb 8, 12:26 am, Lukas Eder <lukas(dot)e(dot)(dot)(dot)(at)gmail(dot)com> wrote:
> I was wondering, is JDBC driver support for the combination of UDT's
> and arrays planned for the near future? I couldn't find any
> documentation on the JDBC drivers website.

After the rather confusing input about a third-party JDBC driver, I
can confirm that access to UDT arrays is possible via the standard
JDBC driver, if done like this:

// This returns a serialised array. Not very convenient
ResultSet rs =...
String serialised = rs.getObject(index);

Or like this

// This allows for iterating over array elements
// and assembling it manually. I'll use this method
// in jOOQ
ResultSet rs =...
ResultSet iterator = rs.getArray(index).getResultSet();

But not like this

// This would be most convenient
ResultSet rs =...
Object[] array = rs.getArray(index).getArray();

> Is there any specific reason (apart from the fact that UDT's and/or
> ARRAYs are not used often) for this lack of implementation? Clearly,
> the database itself supports this combination. I can easily insert and
> select data from a table holding UDT arrays

The question was answered in another thread. I can live with the above
workaround...

In response to

  • UDT arrays at 2011-02-07 23:26:58 from Lukas Eder

Browse pgsql-jdbc by date

  From Date Subject
Next Message Clemens Eisserer 2011-02-24 14:56:10 Slow query execution over WAN network
Previous Message Mike Fowler 2011-02-23 18:30:58 Re: Failing test in org.postgresql.test.jdbc2.DateTest