bug 44136: Don't rollback after successful commit
authorsaper <saper@saper.info>
Tue, 22 Jan 2013 20:53:18 +0000 (21:53 +0100)
committersaper <saper@saper.info>
Tue, 22 Jan 2013 20:53:18 +0000 (21:53 +0100)
For PostgreSQL only:

SavepointPostgres tries to rollback already committed/rolled
back transactions, so after it got committed, don't try
to rollback it again in SavepointPostgres::__destroy.

This happens only when trying to INSERT IGNORE something
without having a transaction open first (e.g. during
unit testing).

Thanks to: OverlordQ <overlordq@gmail.com>

Change-Id: I40ff757a7e2c6ff21f73e1ecd35754e1981f1941

includes/db/DatabasePostgres.php

index 419488e..dcb96fb 100644 (file)
@@ -232,12 +232,14 @@ class SavepointPostgres {
        public function __destruct() {
                if ( $this->didbegin ) {
                        $this->dbw->rollback();
+                       $this->didbegin = false;
                }
        }
 
        public function commit() {
                if ( $this->didbegin ) {
                        $this->dbw->commit();
+                       $this->didbegin = false;
                }
        }