There was an error while loading. Please reload this page.
1 parent 41b4432 commit 46bd8ddCopy full SHA for 46bd8dd
1 file changed
src/providers/postgres/qgspostgresprovider.cpp
@@ -2890,7 +2890,9 @@ long QgsPostgresProvider::featureCount() const
2890
// get total number of features
2891
QString sql;
2892
2893
- if ( !isQuery && mUseEstimatedMetadata )
+ // only use estimated metadata when there is no where clause, otherwise
2894
+ // we get an incorrect feature count for the subset
2895
+ if ( !isQuery && mUseEstimatedMetadata && sqlWhereClause.isEmpty())
2896
{
2897
sql = QString( "select reltuples::int from pg_catalog.pg_class where oid=regclass(%1)::oid" ).arg( quotedValue( mQuery ) );
2898
}
@@ -2904,6 +2906,7 @@ long QgsPostgresProvider::featureCount() const
2904
2906
2905
2907
2908
2909
+
2910
Result result = connectionRO->PQexec( sql );
2911
2912
QgsDebugMsg( "number of features as text: " +
0 commit comments