Set the application_name (to 'bucardo', natch) if the db is >= 9.0
authorGreg Sabino Mullane <greg@endpoint.com>
Sat, 26 Jun 2010 15:14:28 +0000 (11:14 -0400)
committerGreg Sabino Mullane <greg@endpoint.com>
Sat, 26 Jun 2010 15:14:28 +0000 (11:14 -0400)
Bucardo.pm

index bc960b024c0d4d4eabfe5a96a68acfdc94bb007e..f474ffea80bae2e3b1bee36e665672a9b17ab59e 100644 (file)
@@ -282,11 +282,17 @@ sub connect_database {
          {AutoCommit=>0, RaiseError=>1, PrintError=>0}
     );
 
+    ## Set the application name if we can
+    if ($dbh->{pg_server_version} >= 90000) {
+        $dbh->do(q{SET application_name='bucardo'});
+               $dbh->commit();
+       }
+
     ## If we are using something like pgbouncer, we need to tell Bucardo not to
     ## use server-side prepared statements, as they will not span commits/rollbacks.
     if (! $ssp) {
-        $dbh->{pg_server_prepare} = 0;
         $self->glog('Turning off server-side prepares for this database connection', LOG_TERSE);
+        $dbh->{pg_server_prepare} = 0;
     }
 
     ## Grab the backend PID for this Postgres process