Skip to content
Permalink
Browse files
Fix identify tool for PostGIS 1.x layers
curvetoline() function was expected, however:
- in PostGIS < 1.5 such function does not exist
- in PostGIS >=1.5 the function is st_curvetoline()
  • Loading branch information
wonder-sk committed May 27, 2015
1 parent 4edc4b9 commit ed651810312a10fc8ffe20fba414673a483952ac
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/providers/postgres/qgspostgresfeatureiterator.cpp
@@ -297,9 +297,12 @@ QString QgsPostgresFeatureIterator::whereClauseRect()

if ( mRequest.flags() & QgsFeatureRequest::ExactIntersect )
{
QString curveToLineFn; // in postgis < 1.5 the st_curvetoline function does not exist
if ( mConn->majorVersion() >= 2 || ( mConn->majorVersion() == 1 && mConn->minorVersion() >= 5 ) )
curveToLineFn = "st_curvetoline"; // st_ prefix is always used
whereClause += QString( " AND %1(%2(%3%4),%5)" )
.arg( mConn->majorVersion() < 2 ? "intersects" : "st_intersects" )
.arg( mConn->majorVersion() < 2 ? "curvetoline" : "st_curvetoline" )
.arg( curveToLineFn )
.arg( QgsPostgresConn::quotedIdentifier( mSource->mGeometryColumn ) )
.arg( castToGeometry ? "::geometry" : "" )
.arg( qBox );

0 comments on commit ed65181

Please sign in to comment.