Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Provider] PostgreSQL: Using QgsApplication::applicationFullName for …
…application_name
  • Loading branch information
rldhont committed Jan 16, 2023
1 parent 27b3ff7 commit 5deca63
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/providers/postgres/qgspostgresconn.cpp
Expand Up @@ -32,6 +32,7 @@
#include "qgspostgresconnpool.h"
#include "qgsvariantutils.h"
#include "qgsdbquerylog.h"
#include "qgsapplication.h"

#include <QApplication>
#include <QStringList>
Expand Down Expand Up @@ -449,8 +450,11 @@ QgsPostgresConn::QgsPostgresConn( const QString &conninfo, bool readOnly, bool s

if ( mPostgresqlVersion >= 90000 )
{
LoggedPQexecNR( "QgsPostgresConn", QStringLiteral( "SET application_name='QGIS'" ) );
LoggedPQexecNR( "QgsPostgresConn", QStringLiteral( "SET extra_float_digits=3" ) );
// Quoting floating point values and application name for PostgreSQL connection in 1 request
LoggedPQexecNR(
"QgsPostgresConn",
QStringLiteral( "SET extra_float_digits=3; SET application_name=%1" ).arg( quotedValue( QgsApplication::applicationFullName() ) )
);
}

PQsetNoticeProcessor( mConn, noticeProcessor, nullptr );
Expand Down

0 comments on commit 5deca63

Please sign in to comment.