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 committed Jun 7, 2011
1 parent 03525ea commit c1065b9cd64945d04ac9c668a8547b664b47f2b9
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 c1065b9

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