Skip to content
Permalink
Browse files

Merge pull request #5677 from mhugo/fix_slow_relation_reference

Postgresql: don't fetch if there is nothing (fixes #17502)
  • Loading branch information
mhugo committed Nov 20, 2017
2 parents ac109e4 + 5fb970a commit dbd4f9efc20b94ef70eb9311725d80bb3471d024
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/providers/postgres/qgspostgresfeatureiterator.cpp
@@ -31,6 +31,7 @@ const int QgsPostgresFeatureIterator::sFeatureQueueSize = 2000;

QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource* source, bool ownSource, const QgsFeatureRequest& request )
: QgsAbstractFeatureIteratorFromSource<QgsPostgresFeatureSource>( source, ownSource, request )
, mConn( nullptr )
, mFeatureQueueSize( sFeatureQueueSize )
, mFetched( 0 )
, mFetchGeometry( false )
@@ -39,6 +40,13 @@ QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource
, mLastFetch( false )
, mFilterRequiresGeometry( false )
{
if ( request.filterType() == QgsFeatureRequest::FilterFids && request.filterFids().isEmpty() )
{
mClosed = true;
iteratorClosed();
return;
}

if ( !source->mTransactionConnection )
{
mConn = QgsPostgresConnPool::instance()->acquireConnection( mSource->mConnInfo );

0 comments on commit dbd4f9e

Please sign in to comment.
You can’t perform that action at this time.