Skip to content
Permalink
Browse files

[BUGFIX] [Virtual provider] Make QgsVirtualLayerFeatureIterator() reb…

…ust to references to non existing fields in filter expression
  • Loading branch information
rouault committed Jan 20, 2020
1 parent c586029 commit 992ad09fb17ac34e0377b71484cf75ba0369bcfb
Showing with 2 additions and 3 deletions.
  1. +2 −3 src/providers/virtual/qgsvirtuallayerfeatureiterator.cpp
@@ -138,10 +138,9 @@ QgsVirtualLayerFeatureIterator::QgsVirtualLayerFeatureIterator( QgsVirtualLayerF
// ensure that all attributes required for expression filter are being fetched
if ( request.filterType() == QgsFeatureRequest::FilterExpression )
{
const auto constReferencedColumns = request.filterExpression()->referencedColumns();
for ( const QString &field : constReferencedColumns )
const QSet<int> attributeIndexes = request.filterExpression()->referencedAttributeIndexes( mSource->mFields );
for ( int attrIdx : attributeIndexes )
{
int attrIdx = mSource->mFields.lookupField( field );
if ( !mAttributes.contains( attrIdx ) )
mAttributes << attrIdx;
}

0 comments on commit 992ad09

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