PostGISDialect Error with PostGIS 2.0

Description

An SQLException is thrown from org.geotools.data.postgis.PostGISDialect#getGeometryDimension with PostGIS 2.x if the geometry column does not have an entry in the geometry_columns table. When building the SQL statement, it is using the PostGIS 1.x function name which does not exist in 2.x:

String sqlStatement = "SELECT DIMENSION(\"" + columnName + "\") " +

In this line, DIMENSION needs to be changed to ST_DIMENSION although based on the usage, ST_NDIMS may be the appropriate function to use here instead of ST_DIMENSION.

http://postgis.net/docs/ST_Dimension.html
http://postgis.net/docs/ST_NDims.html

Environment

None

Activity

Show:
Shane St Clair
March 15, 2016, 8:11 AM

This issue is still present, at least in the 14.x line. When I start GeoServer 2.8.2, this error is thrown once per layer as all layers are scanned. With over 1,000 layers this delays startup for over six minutes.

I'm willing to make a PR, but can someone in the know verify which of the two suggested functions should replace the missing DIMENSION (ST_Dimension or ST_NDims)?

Shane St Clair
March 15, 2016, 8:07 PM

It's ST_NDims. Checking with the mailing list...

Shane St Clair
March 17, 2016, 9:21 AM

Actually it's ST_Dimension. Opened pull request:

https://github.com/geotools/geotools/pull/1130

Justin Deoliveira
March 17, 2016, 7:00 PM

I took a quick look and the patch looks good to me. Commented with a +1 on
the pull request.

On Thu, Mar 17, 2016 at 12:29 PM Andrea Aime <andrea.aime@geo-solutions.it>

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Andrea Aime
February 15, 2017, 11:35 AM

Mass transitioning all resolved issues that have not been updated in the last month to closed state

Fixed

Assignee

Unassigned

Reporter

Steve Ikeoka

Triage

None

Components

Fix versions

Affects versions

Priority

Medium
Configure