BUG #4638: Bug with Geometry in Array

From: "Bjoern Weitzig" <weitzig(at)supportgis(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4638: Bug with Geometry in Array
Date: 2009-02-03 12:49:22
Message-ID: 200902031249.n13CnMQU004261@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4638
Logged by: Bjoern Weitzig
Email address: weitzig(at)supportgis(dot)de
PostgreSQL version: 8.3.5
Operating system: Windows
Description: Bug with Geometry in Array
Details:

System: PostgreSQL 8.3.5, compiled by Visual C++ build 1400
(Windows-Installer), PostGIS 1.3.5, GEOS 3.0.3-CAPI-1.4.2 on Windows

I use arrays like "select array(select n from a)". This works well except of
the case with geometry as datatype.

In case of geometry, the JDBC ResultSet.getArray(1).getResultSet() only
lists the first element.

Testcase:

create table a(n VARCHAR);
SELECT AddGeometryColumn( 'a', 'feature', -1, 'GEOMETRY', 3 );
INSERT INTO a(n, feature) VALUES (1,GeomFromText('Point(1 1 0)',-1));
INSERT INTO a(n, feature) VALUES (2,GeomFromText('Point(2 2 0)',-1));

select array(select n from a);
=> "{1,2}" (ok)
select array(select feature from a);
=>

"{0101000080000000000000F03F000000000000F03F0000000000000000:010100008000000
0000000004000000000000000400000000000000000}"
I wonder why there is a ":" instead of an ",".

JDBC:
ResultSet rset = stmt.executeQuery("select array(select feature from
a)");
if (rset.next()) {
Array array = rset.getArray(1);
ResultSet rs2 = array.getResultSet();
int n=0;
while (rs2.next()) {
Object o = rs2.getObject(2);
n++;
System.out.println(n+": "+o);
}
rs2.close();
}
This lists only the first point "1: POINT(1 1 0)", instead of expected "1:
POINT(1 1 0) \n 2: POINT(2 2 0)"

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-02-03 17:43:22 Re: BUG #4638: Bug with Geometry in Array
Previous Message Stefan Kaltenbrunner 2009-02-03 09:59:22 Re: BUG #4637: FATAL: sorry, too many clients already