mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix for bug#50946: fast index creation still seems to copy the table
Problem: ALTER TABLE ADD INDEX may lead to table copying if there's numeric field(s) with non-default display width modificator specified. Fix: compare numeric field's storage lenghts when we decide whether they can be considered 'equal' for table alteration purposes.
This commit is contained in:
12
sql/field.cc
12
sql/field.cc
@ -8878,14 +8878,20 @@ bool Field_num::eq_def(Field *field)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check whether two numeric fields can be considered 'equal' for table
|
||||
alteration purposes. Fields are equal if they are of the same type
|
||||
and retain the same pack length.
|
||||
*/
|
||||
|
||||
uint Field_num::is_equal(Create_field *new_field)
|
||||
{
|
||||
return ((new_field->sql_type == real_type()) &&
|
||||
((new_field->flags & UNSIGNED_FLAG) == (uint) (flags &
|
||||
UNSIGNED_FLAG)) &&
|
||||
((new_field->flags & UNSIGNED_FLAG) ==
|
||||
(uint) (flags & UNSIGNED_FLAG)) &&
|
||||
((new_field->flags & AUTO_INCREMENT_FLAG) ==
|
||||
(uint) (flags & AUTO_INCREMENT_FLAG)) &&
|
||||
(new_field->length <= max_display_length()));
|
||||
(new_field->pack_length == pack_length()));
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user