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.
This commit is contained in:
parent
03cb5f8acf
commit
e8cee706fe
2 changed files with 5 additions and 50 deletions
1
CREDITS
1
CREDITS
|
|
@ -123,7 +123,6 @@ following names for their contribution to the product.
|
|||
* Lejonel
|
||||
* liangent
|
||||
* Louperivois
|
||||
* Luca Fulchir
|
||||
* Lucas Garczewski
|
||||
* Luigi Corsaro
|
||||
* Lupo
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue