Skip to content
Permalink
Browse files

Postgresql: don't fetch if there is nothing (fixes #17502)

  • Loading branch information
mhugo committed Nov 20, 2017
1 parent 33e939c commit 5fb970abbe944b879e018e7c18247377aac8988b
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 5fb970a

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