Skip to content

Commit

Permalink
do not call deduceEndian() if PGver >= 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
MorriganR authored and nyalldawson committed Jul 5, 2023
1 parent 00c47de commit 8c4602d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/providers/postgres/qgspostgresconn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,21 @@ QgsPostgresConn::QgsPostgresConn( const QString &conninfo, bool readOnly, bool s
logWrapper = nullptr;
QgsDebugMsgLevel( QStringLiteral( "Connection to the database was successful" ), 2 );

deduceEndian();
mPostgresqlVersion = PQserverVersion( mConn );
if ( mPostgresqlVersion < 70400 )
{
deduceEndian();
}
else
{
// todo - std::endian
int testInt = 1;
// mem addr: -->
// testInt(little-endian): 01 0...0 00
// testInt(big-endian): 00 0...0 01
// *char: ^^
mSwapEndian = *( char * )&testInt == 1;
}

/* Check to see if we have working PostGIS support */
if ( !postgisVersion().isNull() )
Expand Down

0 comments on commit 8c4602d

Please sign in to comment.