Fix bug where renaming a tablespace was leading to an error
authorJehan-Guillaume (ioguix) de Rorthais <ioguix@free.fr>
Thu, 23 Feb 2012 18:16:23 +0000 (19:16 +0100)
committerJehan-Guillaume (ioguix) de Rorthais <ioguix@free.fr>
Thu, 23 Feb 2012 18:18:09 +0000 (19:18 +0100)
When renaming a tablespace, it was renamed first, then a comment was set
on its old name in the same xact, leading to an error and rollback.

classes/database/Postgres.php

index 3ce50e9d172ef5f63cd3989a03be03f66e16727e..d28df991af86e2af325864c91cce7ce20ecb9aba 100755 (executable)
@@ -7058,10 +7058,12 @@ class Postgres extends ADODB_base {
                if ($name != $spcname) {
                        $sql = "ALTER TABLESPACE \"{$spcname}\" RENAME TO \"{$name}\"";
                        $status = $this->execute($sql);
-               if ($status != 0) {
-                       $this->rollbackTransaction();
-                       return -3;
-               }
+                       if ($status != 0) {
+                               $this->rollbackTransaction();
+                               return -3;
+                       }
+
+                       $spcname = $name;
                }
 
                // Set comment if it has changed