Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -708,14 +708,19 @@ |
709 | 709 | # Replace reserved words with better ones |
710 | 710 | switch( $name ) { |
711 | 711 | case 'user': |
712 | | - return 'mwuser'; |
| 712 | + return $this->realTableName( 'mwuser', $format ); |
713 | 713 | case 'text': |
714 | | - return 'pagecontent'; |
| 714 | + return $this->realTableName( 'pagecontent', $format ); |
715 | 715 | default: |
716 | | - return parent::tableName( $name, $format ); |
| 716 | + return $this->realTableName( $name, $format ); |
717 | 717 | } |
718 | 718 | } |
719 | 719 | |
| 720 | + /* Don't cheat on installer */ |
| 721 | + function realTableName( $name, $format = 'quoted' ) { |
| 722 | + return parent::tableName( $name, $format ); |
| 723 | + } |
| 724 | + |
720 | 725 | /** |
721 | 726 | * Return the next in a sequence, save the value for retrieval via insertId() |
722 | 727 | * @return null |
— | — | @@ -990,7 +995,7 @@ |
991 | 996 | if ( !$schema ) { |
992 | 997 | $schema = $this->getCoreSchema(); |
993 | 998 | } |
994 | | - $table = $this->tableName( $table, 'raw' ); |
| 999 | + $table = $this->realTableName( $table, 'raw' ); |
995 | 1000 | $etable = $this->addQuotes( $table ); |
996 | 1001 | $eschema = $this->addQuotes( $schema ); |
997 | 1002 | $SQL = "SELECT 1 FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n " |
Index: trunk/phase3/includes/installer/PostgresUpdater.php |
— | — | @@ -27,6 +27,11 @@ |
28 | 28 | */ |
29 | 29 | protected function getCoreUpdateList() { |
30 | 30 | return array( |
| 31 | + # rename tables 1.7.3 |
| 32 | + # r15791 Change reserved word table names "user" and "text" |
| 33 | + array( 'renameTable', 'user', 'mwuser'), |
| 34 | + array( 'renameTable', 'text', 'pagecontent'), |
| 35 | + |
31 | 36 | # new sequences |
32 | 37 | array( 'addSequence', 'logging_log_id_seq' ), |
33 | 38 | array( 'addSequence', 'page_restrictions_pr_id_seq' ), |
— | — | @@ -406,7 +411,8 @@ |
407 | 412 | protected function renameTable( $old, $new ) { |
408 | 413 | if ( $this->db->tableExists( $old ) ) { |
409 | 414 | $this->output( "Renaming table $old to $new\n" ); |
410 | | - $old = $this->db->addQuotes( $old ); |
| 415 | + $old = $this->db->realTableName( $old, "quoted" ); |
| 416 | + $new = $this->db->realTableName( $new, "quoted" ); |
411 | 417 | $this->db->query( "ALTER TABLE $old RENAME TO $new" ); |
412 | 418 | } |
413 | 419 | } |
Index: trunk/phase3/includes/installer/DatabaseInstaller.php |
— | — | @@ -158,7 +158,7 @@ |
159 | 159 | } |
160 | 160 | $this->db->selectDB( $this->getVar( 'wgDBname' ) ); |
161 | 161 | |
162 | | - if( $this->db->tableExists( 'user', __METHOD__ ) ) { |
| 162 | + if( $this->db->tableExists( 'archive', __METHOD__ ) ) { |
163 | 163 | $status->warning( 'config-install-tables-exist' ); |
164 | 164 | $this->enableLB(); |
165 | 165 | return $status; |