From e8cee706fe58d1487e6e7bb1d77c7c2b39987ea0 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 3 Feb 2012 23:37:30 +0000 Subject: [PATCH] Reverted r106025 and friends (r106370, r106373, r108060, r108337, r106419). This can go in 1.20 if a Postgres person has time to look at it. --- CREDITS | 1 - includes/db/DatabasePostgres.php | 54 +++----------------------------- 2 files changed, 5 insertions(+), 50 deletions(-) diff --git a/CREDITS b/CREDITS index 93eb73414f..059319377e 100644 --- a/CREDITS +++ b/CREDITS @@ -123,7 +123,6 @@ following names for their contribution to the product. * Lejonel * liangent * Louperivois -* Luca Fulchir * Lucas Garczewski * Luigi Corsaro * Lupo diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index 2f0cdb4f0f..2b0c0a3397 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -624,59 +624,15 @@ class DatabasePostgres extends DatabaseBase { } function tableName( $name, $format = 'quoted' ) { - global $wgSharedDB, $wgSharedTables; - # Skip quoted tablenames. - if ( $this->isQuotedIdentifier( $name ) ) { - return $name; - } - # Lets test for any bits of text that should never show up in a table - # name. Basically anything like JOIN or ON which are actually part of - # SQL queries, but may end up inside of the table value to combine - # sql. Such as how the API is doing. - # Note that we use a whitespace test rather than a \b test to avoid - # any remote case where a word like on may be inside of a table name - # surrounded by symbols which may be considered word breaks. - if ( preg_match( '/(^|\s)(DISTINCT|JOIN|ON|AS)(\s|$)/i', $name ) !== 0 ) { - return $name; - } - # Extract the database prefix, if any and quote it - $dbDetails = explode( '.', $name, 2 ); - if ( isset( $dbDetails[1] ) ) { - $schema = '"' . $dbDetails[0] . '".'; - $table = $dbDetails[1]; - } else { - $schema = ""; # do NOT force the schema (due to temporary tables) - $table = $dbDetails[0]; - } - if ( $format != 'quoted' ) { - switch( $name ) { - case 'user': - return 'mwuser'; - case 'text': - return 'pagecontent'; - default: - return $table; - } - } - - if ( isset( $wgSharedDB ) # We have a shared database (=> schema) - && isset( $wgSharedTables ) - && is_array( $wgSharedTables ) - && in_array( $table, $wgSharedTables ) ) { # A shared table is selected - $schema = "\"{$wgSharedDB}\"."; - } - switch ( $table ) { + # Replace reserved words with better ones + switch( $name ) { case 'user': - $table = "{$schema}\"mwuser\""; - break; + return 'mwuser'; case 'text': - $table = "{$schema}\"pagecontent\""; - break; + return 'pagecontent'; default: - $table = "{$schema}\"$table\""; - break; + return parent::tableName( $name, $format ); } - return $table; } /** -- 2.20.1