summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/sql/field.cc b/sql/field.cc
index bd091f7eb57..fcabaeaa74d 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -8464,14 +8464,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()));
}