Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VUL8j-0005Cc-L8 for pgsql-jdbc@arkaria.postgresql.org; Thu, 10 Oct 2013 18:39:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VUL8j-0008IJ-5Q for pgsql-jdbc@arkaria.postgresql.org; Thu, 10 Oct 2013 18:39:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VUL8i-0008ID-FP for pgsql-jdbc@postgresql.org; Thu, 10 Oct 2013 18:39:12 +0000 Received: from mail.coresystems.ch ([212.243.135.232] helo=mf1.netrics.ch) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VUL8d-0008Qk-PE for pgsql-jdbc@postgresql.org; Thu, 10 Oct 2013 18:39:12 +0000 Received: from VSRV-MAILCL01.CORESYSTEMSAG.LOCAL ([::1]) by vsrv-mailcl01.CORESYSTEMSAG.LOCAL ([::1]) with mapi id 14.01.0421.002; Thu, 10 Oct 2013 20:39:06 +0200 From: Martin Petras To: "pgsql-jdbc@postgresql.org" Subject: Array of UUID is not supported Thread-Topic: Array of UUID is not supported Thread-Index: AQHOxef/qBoyn/wwpUWYErViKSOO6Q== Date: Thu, 10 Oct 2013 18:39:05 +0000 Message-ID: Accept-Language: en-US, de-CH Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.3.7.130812 x-originating-ip: [46.127.3.65] Content-Type: multipart/alternative; boundary="_000_CE7CC0E8582AFmartinpetrascoresystemsch_" MIME-Version: 1.0 X-Pg-Spam-Score: -2.1 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org --_000_CE7CC0E8582AFmartinpetrascoresystemsch_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hey guys, First of all, thanks a lot for working on the PG JDBC driver! By using the driver version 9.2-1003-jdbc4 I'm not able to retrieve a colum= n of type UUID[]. The error description is below. I'm using PG 9.3, version 'PostgreSQL 9.3.0 on x86_64-apple-darwin12.5.0, c= ompiled by Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn), = 64-bit' under Mac OS 10.8.5. Steps to reproduce: 1) run the following queries: CREATE TABLE uuids (id UUID NOT NULL, ids UUID []); insert into uuids values ('a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11', '{a0eebc9= 9-9c0b-4ef8-bb6d-6bb9bd380a11,a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a12}'); 2) run java code: Class.forName( "org.postgresql.Driver"); // load the driver Connection db =3D DriverManager.getConnection("jdbc:postgresql://localhost:= 7432/test", "postgres", "postgres"); PreparedStatement ps =3D db.prepareStatement("select * from uuids"); ResultSet rs =3D ps.executeQuery(); while(rs.next()) { UUID id =3D (UUID) rs.getObject("id"); Array ids =3D rs.getArray("ids"); System.out.println(id + "\t" + ids + "\t" + ids.getArray()); // fails on id= s.getArray() } rs.close(); ps.close(); db.close(); Expected: ids are a proper array of java.util.UUID objects Current: Exception in thread "main" java.sql.SQLFeatureNotSupportedException: Method= org.postgresql.jdbc4.Jdbc4Array.getArrayImpl(long,int,Map) is not yet impl= emented. at org.postgresql.Driver.notImplemented(Driver.java:710) at org.postgresql.jdbc2.AbstractJdbc2Array.buildArray(AbstractJdbc2Array.ja= va:745) at org.postgresql.jdbc2.AbstractJdbc2Array.getArrayImpl(AbstractJdbc2Array.= java:171) at org.postgresql.jdbc2.AbstractJdbc2Array.getArray(AbstractJdbc2Array.java= :128) After quick look in the code around org/postgresql/jdbc2/AbstractJdbc2Array= .java:745, it seems that there are two problems: 1) type of objects in the array is resolved to java.sql.Types#OTHER 2) if it is possible to resolve the type to find out it's UUID, it's just u= p to call UUID.fromString( for each entry in 'input') as input already cont= ains string representations of UUIDs I hope you'll find some time to fix it as I'd love to use the feature in my= project. Thanks and cheers, Martin Petras --_000_CE7CC0E8582AFmartinpetrascoresystemsch_ Content-Type: text/html; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable
Hey guys,

First of all, thanks a lot for working on the PG JDBC driver!

By using the driver version 9.2-1003-jdbc4 I'm not able to retrieve a = column of type UUID[]. The error description is below.

I'm using PG 9.3, version 'PostgreSQL 9.3.0 on x86_64-apple-darwi= n12.5.0, compiled by Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM= 3.2svn), 64-bit' under Mac OS 10.8.5.

Steps to reproduce:
1) run the following queries:
CREATE= TABLE uuids (id UUID NOT NULL, ids UUID []);
insert= into uuids values ('a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11', '{a0eebc99-9c0b= -4ef8-bb6d-6bb9bd380a11,a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a12}');

2) run java code:
Class.= forName( "org.postgresql.Driver"); // load the driver
Connec= tion db =3D DriverManager.getConnection("jdbc:postgresql://localhost:7= 432/test", "postgres", "postgres");
Prepar= edStatement ps =3D db.prepareStatement("select * from uuids");
Result= Set rs =3D ps.executeQuery();
while(= rs.next()) {
UUID i= d =3D (UUID) rs.getObject("id");
Array = ids =3D rs.getArray("ids");
System= .out.println(id + "\t" + ids + "\t" + i= ds.getArray()); // fails on ids.getArray()
}
rs.clo= se();
ps.clo= se();
db.clo= se();

Expected: ids are a proper array of java.util.UUID objects
Current: 
Exception in thread "main" java.sql.SQLFeatureNotSupportedEx= ception: Method org.postgresql.jdbc4.Jdbc4Array.getArrayImpl(long,int,Map) = is not yet implemented.
at = org.postgresql.Driver.notImplemented(Driver.java:710)
at = org.postgresql.jdbc2.AbstractJdbc2Array.buildArray(AbstractJdbc2Array.java:= 745)
at = org.postgresql.jdbc2.AbstractJdbc2Array.getArrayImpl(AbstractJdbc2Array.jav= a:171)
at = org.postgresql.jdbc2.AbstractJdbc2Array.getArray(AbstractJdbc2Array.java:12= 8)


After quick look in the code around org/postgresql/jdbc2/AbstractJdbc2= Array.java:745, it seems that there are two problems:
1) type of objects in the array is resolved to java.sql.Types#OTH= ER
2) if it is possible to resolve the type to find out it's UUID, it's j= ust up to call UUID.fromString( for each entry in 'input') as input al= ready contains string representations of UUIDs

I hope you'll find some time to fix it as I'd love to use the feature = in my project.

Thanks and cheers,

Martin Petras
--_000_CE7CC0E8582AFmartinpetrascoresystemsch_--