diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-07-20 15:52:06 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-07-20 20:13:28 +0200 |
commit | 3ef5596505bd8d80fa80d1cf7514550434eb1d79 (patch) | |
tree | a89c97a6673dd0718f6eb4b3433bd74d576d6865 /sql/field.cc | |
parent | 7e507f262a826c9c799355755541120be8c7352a (diff) | |
download | mariadb-git-3ef5596505bd8d80fa80d1cf7514550434eb1d79.tar.gz |
MDEV-13175 Adding a new enum value at the end of a list triggers a table rebuild
Backport of 7e29f2d64fb from 10.1.
Create_field does not set BINARY_FLAG, so the check didn't work at all.
Also, character sets were already compared, so this check would've been
redundant (if it would've worked).
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sql/field.cc b/sql/field.cc index 7d7fad2d84d..7a44bcadd3c 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -6403,9 +6403,6 @@ uint Field::is_equal(Create_field *new_field) uint Field_str::is_equal(Create_field *new_field) { - if (field_flags_are_binary() != new_field->field_flags_are_binary()) - return 0; - return ((new_field->sql_type == real_type()) && new_field->charset == field_charset && new_field->length == max_display_length()); @@ -7810,9 +7807,6 @@ uint Field_blob::max_packed_col_length(uint max_length) uint Field_blob::is_equal(Create_field *new_field) { - if (field_flags_are_binary() != new_field->field_flags_are_binary()) - return 0; - return ((new_field->sql_type == get_blob_type_from_length(max_data_length())) && new_field->charset == field_charset && new_field->pack_length == pack_length()); @@ -7933,6 +7927,18 @@ Field::geometry_type Field_geom::geometry_type_merge(geometry_type a, return Field::GEOM_GEOMETRY; } + +uint Field_geom::is_equal(Create_field *new_field) +{ + return new_field->sql_type == MYSQL_TYPE_GEOMETRY && + /* + - Allow ALTER..INPLACE to supertype (GEOMETRY), + e.g. POINT to GEOMETRY or POLYGON to GEOMETRY. + - Allow ALTER..INPLACE to the same geometry type: POINT -> POINT + */ + (new_field->geom_type == geom_type || + new_field->geom_type == GEOM_GEOMETRY); +} #endif /*HAVE_SPATIAL*/ /**************************************************************************** @@ -8336,8 +8342,7 @@ uint Field_enum::is_equal(Create_field *new_field) The fields are compatible if they have the same flags, type, charset and have the same underlying length. */ - if (new_field->field_flags_are_binary() != field_flags_are_binary() || - new_field->sql_type != real_type() || + if (new_field->sql_type != real_type() || new_field->charset != field_charset || new_field->pack_length != pack_length()) return IS_EQUAL_NO; |