X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Flibs%2Frdbms%2Fdatabase%2FDatabasePostgres.php;h=c6d5a1459f9fc8cd7265ce006cb91ac7c9d435e0;hp=7c07a07826af8bcda8af3cbb58ec0efab3a746a7;hb=c9ad7037cef3b0a96b2b0e22e21eb7d1e7204d42;hpb=3ff078137ab823b36000699828c564dabb0ffa55 diff --git a/includes/libs/rdbms/database/DatabasePostgres.php b/includes/libs/rdbms/database/DatabasePostgres.php index 7c07a07826..c6d5a1459f 100644 --- a/includes/libs/rdbms/database/DatabasePostgres.php +++ b/includes/libs/rdbms/database/DatabasePostgres.php @@ -202,6 +202,11 @@ class DatabasePostgres extends Database { return $this->conn ? pg_close( $this->conn ) : true; } + protected function isTransactableQuery( $sql ) { + return parent::isTransactableQuery( $sql ) && + !preg_match( '/^SELECT\s+pg_(try_|)advisory_\w+\(/', $sql ); + } + public function doQuery( $sql ) { $conn = $this->getBindingHandle(); @@ -1319,6 +1324,9 @@ SQL; } public function lockIsFree( $lockName, $method ) { + if ( !parent::lockIsFree( $lockName, $method ) ) { + return false; // already held + } // http://www.postgresql.org/docs/8.2/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS $key = $this->addQuotes( $this->bigintFromLockName( $lockName ) ); $result = $this->query( "SELECT (CASE(pg_try_advisory_lock($key))