Issue Details (XML | Word | Printable)

Key: TEST-20
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Baris ERGUN
Reporter: Baris ERGUN
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Test Framework

testGeometryCollectionMMapping of org.datanucleus.tests.PgGeometryPostGISExtMappingTest failure

Created: 21/Dec/13 10:55 AM   Updated: 11/Apr/14 09:12 AM  Due: 25/Dec/13
Component/s: None
Affects Version/s: 3.0
Fix Version/s: 4.0

Datastore: PostgreSQL
Severity: Development


 Description  « Hide
testGeometryCollectionMMapping of org.datanucleus.tests.PgGeometryPostGISExtMappingTest fails with below error.

testGeometryCollectionMMapping[default](org.datanucleus.tests.PgGeometryPostGISExtMappingTest) Time elapsed: 0.077 sec <<< ERROR!
javax.jdo.JDODataStoreException: Insert of object "org.datanucleus.samples.pggeometry.SampleGeometryCollectionM@1d7fe3d" using statement "INSERT INTO samplepggeometrycollectionm (id,geom,"name") VALUES (?,?,?)" failed : ERROR: can not mix dimensionality in a geometry
  Hint: "...100,55 55 100,45 55 100,45 45 100)))" <-- parse error at position 183 within geometry
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334)
at org.datanucleus.store.rdbms.datasource.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at org.datanucleus.store.rdbms.datasource.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at org.datanucleus.store.rdbms.ParamLoggingPreparedStatement.executeUpdate(ParamLoggingPreparedStatement.java:399)
at org.datanucleus.store.rdbms.SQLController.executeStatementUpdate(SQLController.java:439)
at org.datanucleus.store.rdbms.request.InsertRequest.execute(InsertRequest.java:410)
at org.datanucleus.store.rdbms.RDBMSPersistenceHandler.insertTable(RDBMSPersistenceHandler.java:167)
at org.datanucleus.store.rdbms.RDBMSPersistenceHandler.insertObject(RDBMSPersistenceHandler.java:143)
at org.datanucleus.state.JDOStateManager.internalMakePersistent(JDOStateManager.java:3784)
at org.datanucleus.state.JDOStateManager.makePersistent(JDOStateManager.java:3760)
at org.datanucleus.ExecutionContextImpl.persistObjectInternal(ExecutionContextImpl.java:2219)
at org.datanucleus.ExecutionContextImpl.persistObjectWork(ExecutionContextImpl.java:2065)
at org.datanucleus.ExecutionContextImpl.persistObject(ExecutionContextImpl.java:1913)
at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:727)
at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:752)
at org.datanucleus.tests.PgGeometryPostGISExtMappingTest.testGeometryCollectionMMapping(PgGeometryPostGISExtMappingTest.java:185)

The detected root cause is: org.postgis.GeometryCollection constructor

GeometryCollection coll = new GeometryCollection(
                            "SRID=-1;GEOMETRYCOLLECTIONM(POINTM(10 10 100),LINESTRINGM(0 50 100, 100 50 100),POLYGONM((25 25 100,75 25 100,75 75 100,25 75 100,25 25 100),(45 45 100,55 45 100,55 55 100,45 55 100,45 45 100)))"));

when I reprint the coll.toString() I see that my geom string is changed to below :

"SRID=-1;GEOMETRYCOLLECTIONM(POINT(10 10 100),LINESTRING(0 50 100, 100 50 100),POLYGON((25 25 100,75 25 100,75 75 100,25 75 100,25 25 100),(45 45 100,55 45 100,55 55 100,45 55 100,45 45 100)))"

As you can see GEOMETRYCOLLECTIONM is preserved but POINTM LINESTRINGM and POLYGONM is changed to POINT LINESTRING and POLYGON . And because of this I get cannot mix dimensionality when I am trying to insert this geom to database.

I have tried this with postgis jdbc driver 1.1.5; 1.3.3 and 2.0.1 versions.

I will be discussing with Postgis guys and looking for a resolution for this.

Baris ERGUN added a comment - 21/Dec/13 08:49 PM
I have tested with latest snapshot of postgis-jdbc jar which is 2.1.0SVN. The same problem persists in GeometryCollection class constructor. There was a similar issue solved in past for postgis server side extension http://trac.osgeo.org/postgis/ticket/724.

There is constructor which u explicitly enable MMaping "boolean haveM" but that one doesnt resolve as well. When u read java codes it is same as specifying GEOMETRYCOLLECTIONM with letter "M" in String value.

I am trying to push Postgis guys about the problem over mailing list. If we can come to an agreement with them I will update the issue.

Andy Jefferson made changes - 11/Apr/14 09:12 AM
Field Original Value New Value
Fix Version/s 4.0 [ 12171 ]
Fix Version/s 3.3 [ 12066 ]