File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -2890,7 +2890,9 @@ long QgsPostgresProvider::featureCount() const
2890
2890
// get total number of features
2891
2891
QString sql;
2892
2892
2893
- if ( !isQuery && mUseEstimatedMetadata )
2893
+ // 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 ())
2894
2896
{
2895
2897
sql = QString ( " select reltuples::int from pg_catalog.pg_class where oid=regclass(%1)::oid" ).arg ( quotedValue ( mQuery ) );
2896
2898
}
@@ -2904,6 +2906,7 @@ long QgsPostgresProvider::featureCount() const
2904
2906
}
2905
2907
}
2906
2908
2909
+
2907
2910
Result result = connectionRO->PQexec ( sql );
2908
2911
2909
2912
QgsDebugMsg ( " number of features as text: " +
You can’t perform that action at this time.
0 commit comments