Skip to content

Commit

Permalink
Undoing overcorrection on handling bigint min/max values.
Browse files Browse the repository at this point in the history
  • Loading branch information
espinafre committed Apr 27, 2020
1 parent d1497bf commit c5ac1a4
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -1768,14 +1768,7 @@ QVariant QgsPostgresProvider::minimumValue( int index ) const
sql = QStringLiteral( "SELECT %1 FROM (%2) foo" ).arg( connectionRO()->fieldExpression( fld ), sql );

QgsPostgresResult rmin( connectionRO()->PQexec( sql ) );
if ( fld.type() == QVariant::LongLong )
{
return convertValue( fld.type(), fld.subType(), QString::number( connectionRO()->getBinaryInt( rmin, 0, 0 ) ), fld.typeName() );
}
else
{
return convertValue( fld.type(), fld.subType(), rmin.PQgetvalue( 0, 0 ), fld.typeName() );
}
return convertValue( fld.type(), fld.subType(), rmin.PQgetvalue( 0, 0 ), fld.typeName() );
}
catch ( PGFieldNotFound )
{
Expand Down Expand Up @@ -2040,14 +2033,7 @@ QVariant QgsPostgresProvider::maximumValue( int index ) const

QgsPostgresResult rmax( connectionRO()->PQexec( sql ) );

if ( fld.type() == QVariant::LongLong )
{
return convertValue( fld.type(), fld.subType(), QString::number( connectionRO()->getBinaryInt( rmax, 0, 0 ) ), fld.typeName() );
}
else
{
return convertValue( fld.type(), fld.subType(), rmax.PQgetvalue( 0, 0 ), fld.typeName() );
}
return convertValue( fld.type(), fld.subType(), rmax.PQgetvalue( 0, 0 ), fld.typeName() );
}
catch ( PGFieldNotFound )
{
Expand Down

0 comments on commit c5ac1a4

Please sign in to comment.