Last modified: 2012-08-14 18:46:38 UTC
I am upgrading MediaWiki from 1.18.4 to 1.19.1, and running maintenance/update.php script. It fails with error: > A database query syntax error has occurred. > The last attempted database query was: > "SHOW INDEX FROM opencaching-su.`shar_user`" > from within function "UserDupes::hasUniqueIndex". > Database returned error "1064: You have an error in your SQL syntax; check the > manual that corresponds to your MySQL server version for the right syntax to > use near '-su.`shar_user`' at line 1 (localhost)" "opencaching-su" is the name of my database; "shar_" is the table prefix for shared tables. I guess the problem is in not properly quoted database name (it contains dash). I looks the bug is in file Database.php, line ~1975, function tableName: > if ( isset( $database ) ) { > $database = ( $format == 'quoted' || $this->isQuotedIdentifier( $database ) ? $database : $this->addIdentifierQuotes( $database ) ); > } I am not sure about PHP priorities of || and ? operators, but I have added "echo" statement and saw that $database is set and remains unchanged after this piece of code. Then I fixed it to: > if ( isset( $database ) ) { > if ( $format == 'quoted' ) { > $database = ( $this->isQuotedIdentifier( $database ) ? $database : $this->addIdentifierQuotes( $database ) ); > } > } This variant works well to me.
Fix pending review in Gerrit change #15867.
Now merged.