Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 9FD7D6341B1 for ; Wed, 10 Mar 2010 14:12:13 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 74234-04 for ; Wed, 10 Mar 2010 18:12:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail.postgresql.org (Postfix) with ESMTP id 38A74633F22 for ; Wed, 10 Mar 2010 14:12:02 -0400 (AST) Received: by leary.csoft.net (Postfix, from userid 1112) id 4763AA30C; Wed, 10 Mar 2010 13:12:01 -0500 (EST) Date: Wed, 10 Mar 2010 13:12:00 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Andreas Joseph Krogh cc: pgsql-jdbc@postgresql.org Subject: Re: Retrieving multidimentional array-column using JDBC In-Reply-To: <201003100039.14562.andreak@officenet.no> Message-ID: References: <201003100039.14562.andreak@officenet.no> User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/34 X-Sequence-Number: 20374 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=1.19&content-type=text/x-cvsweb-markup Kris Jurka