Skip to content
Permalink
Browse files

Fix feature count for postgres provider so it doesn't use estimated m…

…etadata when reporting results of a subset in the query builder
  • Loading branch information
g-sherman authored and mhugent committed Jun 10, 2011
1 parent 41b4432 commit 46bd8dd804a4252422e22622e6ebf259f51f2cb9
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/providers/postgres/qgspostgresprovider.cpp
@@ -2890,7 +2890,9 @@ long QgsPostgresProvider::featureCount() const
// get total number of features
QString sql;

if ( !isQuery && mUseEstimatedMetadata )
// only use estimated metadata when there is no where clause, otherwise
// we get an incorrect feature count for the subset
if ( !isQuery && mUseEstimatedMetadata && sqlWhereClause.isEmpty())
{
sql = QString( "select reltuples::int from pg_catalog.pg_class where oid=regclass(%1)::oid" ).arg( quotedValue( mQuery ) );
}
@@ -2904,6 +2906,7 @@ long QgsPostgresProvider::featureCount() const
}
}


Result result = connectionRO->PQexec( sql );

QgsDebugMsg( "number of features as text: " +

0 comments on commit 46bd8dd

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