pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Andreas Joseph Krogh <andreak@officenet.no>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Retrieving multidimentional array-column using JDBC
Date: Wed, 10 Mar 2010 13:12:00 -0500 (EST)
Message-ID: <alpine.BSO.2.00.1003101306580.29315@leary.csoft.net> (raw)
In-Reply-To: <201003100039.14562.andreak@officenet.no>
References: <201003100039.14562.andreak@officenet.no>



On Wed, 10 Mar 2010, Andreas Joseph Krogh wrote:

> I have a query which returns a multidimentional array (2D) of varchar 
> and I'm having problems retrieving the results using JDBC.
>
> First, since PG doesn't support arrays of arrays, I've created a custom 
> type:

PG does support multidimensional arrays:

kjurka=# select array[array['a','b'],array['c','d']];
      array
---------------
  {{a,b},{c,d}}
(1 row)

You can then unnest these arrays according to the 
testMultiDimensionalArray or testRecursiveResultSets examples here:

http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/jdbc/pgjdbc/org/postgresql/test/jdbc2/ArrayTest.java?rev...

Kris Jurka



view thread (3+ messages)  latest in thread

Message-ID: <alpine.BSO.2.00.1003101306580.29315@leary.csoft.net>
Permalink:  ../alpine.BSO.2.00.1003101306580.29315@leary.csoft.net/
Also on:    postgresql.org/message-id/alpine.BSO.2.00.1003101306580.29315@leary.csoft.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: books@ejurka.com, andreak@officenet.no
  Subject: Re: Retrieving multidimentional array-column using JDBC
  In-Reply-To: <alpine.BSO.2.00.1003101306580.29315@leary.csoft.net>
  References: <201003100039.14562.andreak@officenet.no> <alpine.BSO.2.00.1003101306580.29315@leary.csoft.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox