From: Sam Reed Date: Sun, 20 Nov 2011 17:54:47 +0000 (+0000) Subject: * (bug 29635) update.php for Postgres creates sequences, then fails when it to rename... X-Git-Tag: 1.31.0-rc.0~26384 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=22b42abc7047d5d2c9888d7a01f5d50eb5ab52a0;p=lhc%2Fweb%2Fwiklou.git * (bug 29635) update.php for Postgres creates sequences, then fails when it to rename sequences to those same names Patch by Luigi Corsaro --- diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php index ae96e488d7..48fc1505df 100644 --- a/includes/installer/PostgresUpdater.php +++ b/includes/installer/PostgresUpdater.php @@ -15,6 +15,11 @@ 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" );