Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 ed65181
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/providers/postgres/qgspostgresfeatureiterator.cpp
Expand Up @@ -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 );
Expand Down

0 comments on commit ed65181

Please sign in to comment.