Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c108923

Browse files
committedMar 8, 2019
[postgres] Fix estimated metadata queries fail for huge tables
Fixes #21517
1 parent 6bccc8e commit c108923

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3187,7 +3187,7 @@ long QgsPostgresProvider::featureCount() const
31873187
// - but make huge dataset usable.
31883188
if ( !mIsQuery && mUseEstimatedMetadata )
31893189
{
3190-
sql = QStringLiteral( "SELECT reltuples::int FROM pg_catalog.pg_class WHERE oid=regclass(%1)::oid" ).arg( quotedValue( mQuery ) );
3190+
sql = QStringLiteral( "SELECT reltuples::bigint FROM pg_catalog.pg_class WHERE oid=regclass(%1)::oid" ).arg( quotedValue( mQuery ) );
31913191
}
31923192
else
31933193
{
@@ -3246,7 +3246,7 @@ QgsRectangle QgsPostgresProvider::extent() const
32463246
{
32473247
if ( result.PQgetvalue( 0, 0 ).toInt() > 0 )
32483248
{
3249-
sql = QStringLiteral( "SELECT reltuples::int FROM pg_catalog.pg_class WHERE oid=regclass(%1)::oid" ).arg( quotedValue( mQuery ) );
3249+
sql = QStringLiteral( "SELECT reltuples::bigint FROM pg_catalog.pg_class WHERE oid=regclass(%1)::oid" ).arg( quotedValue( mQuery ) );
32503250
result = connectionRO()->PQexec( sql );
32513251
if ( result.PQresultStatus() == PGRES_TUPLES_OK
32523252
&& result.PQntuples() == 1

0 commit comments

Comments
 (0)
Please sign in to comment.