r103766 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103765‎ | r103766 | r103767 >
Date:17:54, 20 November 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
* (bug 29635) update.php for Postgres creates sequences, then fails when it to rename sequences to those same names

Patch by Luigi Corsaro
Modified paths:
  • /trunk/phase3/includes/installer/PostgresUpdater.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/PostgresUpdater.php
@@ -16,6 +16,11 @@
1717 class PostgresUpdater extends DatabaseUpdater {
1818
1919 /**
 20+ * @var DatabasePostgres
 21+ */
 22+ protected $db;
 23+
 24+ /**
2025 * @todo FIXME: Postgres should use sequential updates like Mysql, Sqlite
2126 * and everybody else. It never got refactored like it should've.
2227 */
@@ -390,6 +395,10 @@
391396 }
392397
393398 protected function renameSequence( $old, $new ) {
 399+ if ( $this->db->sequenceExists( $new ) ) {
 400+ $this->output( "WARNING sequence $new already exists\n" );
 401+ return;
 402+ }
394403 if ( $this->db->sequenceExists( $old ) ) {
395404 $this->output( "Renaming sequence $old to $new\n" );
396405 $this->db->query( "ALTER SEQUENCE $old RENAME TO $new" );

Comments

#Comment by OverlordQ (talk | contribs)   19:44, 21 November 2011

A better fix would be do the sequence renames before the add, otherwise we'd lose our current position per the comment 6 on the bug.

https://bugzilla.wikimedia.org/show_bug.cgi?id=29635#c6

#Comment by 😂 (talk | contribs)   14:48, 1 December 2011

Even better would be changing Postgres to doing its updates chronologically like all the other DBMSs ;-)

Status & tagging log