* (bug 29635) update.php for Postgres creates sequences, then fails when it to rename...
authorSam Reed <reedy@users.mediawiki.org>
Sun, 20 Nov 2011 17:54:47 +0000 (17:54 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sun, 20 Nov 2011 17:54:47 +0000 (17:54 +0000)
Patch by Luigi Corsaro

includes/installer/PostgresUpdater.php

index ae96e48..48fc150 100644 (file)
 
 class PostgresUpdater extends DatabaseUpdater {
 
+       /**
+        * @var DatabasePostgres
+        */
+       protected $db;
+
        /**
         * @todo FIXME: Postgres should use sequential updates like Mysql, Sqlite
         * and everybody else. It never got refactored like it should've.
@@ -390,6 +395,10 @@ END;
        }
 
        protected function renameSequence( $old, $new ) {
+               if ( $this->db->sequenceExists( $new ) ) {
+                       $this->output( "WARNING sequence $new already exists\n" );
+                       return;
+               }
                if ( $this->db->sequenceExists( $old ) ) {
                        $this->output( "Renaming sequence $old to $new\n" );
                        $this->db->query( "ALTER SEQUENCE $old RENAME TO $new" );