The following bug has been logged online:

Bug reference:      4638
Logged by:          Bjoern Weitzig
Email address:      weit...@supportgis.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)"

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to