From: mkanat%kerio.com <> Date: Mon, 1 Aug 2005 17:11:59 +0000 (+0000) Subject: Bug 301901: Index rename failure when renaming an index called PRIMARY X-Git-Tag: bugzilla-2.20rc2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c311b891f299021844535b73727d9e1910ca596;p=thirdparty%2Fbugzilla.git Bug 301901: Index rename failure when renaming an index called PRIMARY Patch By Max Kanat-Alexander r=justdave, a=justdave --- diff --git a/Bugzilla/DB/Schema/Mysql.pm b/Bugzilla/DB/Schema/Mysql.pm index 2c7d80b36a..ba6ac7280e 100644 --- a/Bugzilla/DB/Schema/Mysql.pm +++ b/Bugzilla/DB/Schema/Mysql.pm @@ -184,6 +184,9 @@ sub get_rename_indexes_ddl { my $type = $indexes{$old_name}->{TYPE}; $type ||= 'INDEX'; my $fields = join(',', @{$indexes{$old_name}->{FIELDS}}); + # $old_name needs to be escaped, sometimes, because it was + # a reserved word. + $old_name = '`' . $old_name . '`'; $sql .= " ADD $type $name ($fields), DROP INDEX $old_name,"; } # Remove the last comma.