Bug 301901: Index rename failure when renaming an index called PRIMARY

Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=justdave, a=justdave
This commit is contained in:
mkanat%kerio.com 2005-08-01 10:06:43 +00:00
parent 64bfdc420e
commit 6b16ef1ad2

View File

@ -184,6 +184,9 @@ sub get_rename_indexes_ddl {
my $type = $indexes{$old_name}->{TYPE}; my $type = $indexes{$old_name}->{TYPE};
$type ||= 'INDEX'; $type ||= 'INDEX';
my $fields = join(',', @{$indexes{$old_name}->{FIELDS}}); 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,"; $sql .= " ADD $type $name ($fields), DROP INDEX $old_name,";
} }
# Remove the last comma. # Remove the last comma.