[postgis-devel] FWD: BUG #4638: Bug with Geometry in Array

Obe, Regina robe.dnd at cityofboston.gov
Tue Feb 3 07:53:49 PST 2009


Tom,

I tested the below and yes the : is expected behavior and the way geom
arrays are displayed.

This is testing on 
"POSTGIS="1.3.5" GEOS="3.0.3-CAPI-1.4.2" PROJ="Rel. 4.6.1, 21 August
2008" USE_STATS"
Though I only have 8.2 and 8.3.1 here so can't be sure there isn't an
issue with 8.3.5

I can't test the java part, but if I do this, things work as expected

SELECT ST_AsEWKT(b.geoma[1]) as p1, ST_AsEWKT(b.geoma[2]) As p2
FROM (SELECT array(select feature from a) As geoma)  As b

--Gives me 
     p1      |      p2
-------------+--------------
POINT(1 1 0) | POINT(2 2 0)

Can he try the above test?

So I think his problem might be on the javaside which I know  little
about.

Is he using just regular JDBC driver?  If he is, he should be using the
PostGIS enhanced one and perhaps that is the problem.
http://postgis.refractions.net/documentation/manual-1.3.6SVN/ch04.html#i
d2726248
or maybe there is a bug in that when it comes to arrays.


Hope that helps,
Regina


-----Original Message-----
From: postgis-devel-bounces at postgis.refractions.net
[mailto:postgis-devel-bounces at postgis.refractions.net] On Behalf Of Tom
Lane
Sent: Tuesday, February 03, 2009 10:29 AM
To: postgis-devel at postgis.refractions.net
Subject: [postgis-devel] FWD: BUG #4638: Bug with Geometry in Array

Can anyone here reproduce the behavior complained of below?
(I haven't got postgis installed ATM, so not convenient to try it
myself)

			regards, tom lane

------- Forwarded Message

Date:    Tue, 3 Feb 2009 12:49:22 GMT
From:    "Bjoern Weitzig" <weitzig at supportgis.de>
To:      pgsql-bugs at postgresql.org
Subject: [BUGS] BUG #4638: Bug with Geometry in Array


The following bug has been logged online:

Bug reference:      4638
Logged by:          Bjoern Weitzig
Email address:      weitzig at 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:01010000800
0000
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 at postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

------- End of Forwarded Message

_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.



More information about the postgis-devel mailing list