From 90b3efb93dd0b6460ce496a8acd7fcbf34b22f63 Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Fri, 26 Jun 2015 16:55:45 +0200 Subject: [PATCH] postgres provider: also cast geography to geometry when using && (fixes #8572) --- src/providers/postgres/qgspostgresfeatureiterator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/providers/postgres/qgspostgresfeatureiterator.cpp b/src/providers/postgres/qgspostgresfeatureiterator.cpp index 6904b1c8ff20..305647b8da11 100644 --- a/src/providers/postgres/qgspostgresfeatureiterator.cpp +++ b/src/providers/postgres/qgspostgresfeatureiterator.cpp @@ -289,14 +289,14 @@ QString QgsPostgresFeatureIterator::whereClauseRect() .arg( mSource->mRequestedSrid.isEmpty() ? mSource->mDetectedSrid : mSource->mRequestedSrid ); } + bool castToGeometry = mSource->mSpatialColType == sctGeography || + mSource->mSpatialColType == sctPcPatch; + QString whereClause = QString( "%1%2 && %3" ) .arg( QgsPostgresConn::quotedIdentifier( mSource->mGeometryColumn ) ) - .arg( mSource->mSpatialColType == sctPcPatch ? "::geometry" : "" ) + .arg( castToGeometry ? "::geometry" : "" ) .arg( qBox ); - bool castToGeometry = mSource->mSpatialColType == sctGeography || - mSource->mSpatialColType == sctPcPatch; - if ( mRequest.flags() & QgsFeatureRequest::ExactIntersect ) { QString curveToLineFn; // in postgis < 1.5 the st_curvetoline function does not exist