postgres provider: also cast geography to geometry when using && (fixes #8572)

This commit is contained in:
Juergen E. Fischer 2015-06-26 16:55:45 +02:00
parent 16ad2f82d4
commit 90b3efb93d

View File

@ -289,14 +289,14 @@ QString QgsPostgresFeatureIterator::whereClauseRect()
.arg( mSource->mRequestedSrid.isEmpty() ? mSource->mDetectedSrid : mSource->mRequestedSrid );
}
QString whereClause = QString( "%1%2 && %3" )
.arg( QgsPostgresConn::quotedIdentifier( mSource->mGeometryColumn ) )
.arg( mSource->mSpatialColType == sctPcPatch ? "::geometry" : "" )
.arg( qBox );
bool castToGeometry = mSource->mSpatialColType == sctGeography ||
mSource->mSpatialColType == sctPcPatch;
QString whereClause = QString( "%1%2 && %3" )
.arg( QgsPostgresConn::quotedIdentifier( mSource->mGeometryColumn ) )
.arg( castToGeometry ? "::geometry" : "" )
.arg( qBox );
if ( mRequest.flags() & QgsFeatureRequest::ExactIntersect )
{
QString curveToLineFn; // in postgis < 1.5 the st_curvetoline function does not exist