Commit 3ef55965 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-13175 Adding a new enum value at the end of a list triggers a table rebuild

Backport of 7e29f2d6 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).
parent 7e507f26
...@@ -73,3 +73,114 @@ drop table t1; ...@@ -73,3 +73,114 @@ drop table t1;
create table t1 (a int) partition by hash(a) partitions 2; create table t1 (a int) partition by hash(a) partitions 2;
alter online table t1 modify a int comment 'test'; alter online table t1 modify a int comment 'test';
drop table t1; drop table t1;
#
# MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB
#
CREATE TABLE t1 (a BINARY(10));
ALTER TABLE t1 MODIFY a BINARY(10), ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a VARBINARY(10));
ALTER TABLE t1 MODIFY a VARBINARY(10), ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a TINYBLOB);
ALTER TABLE t1 MODIFY a TINYBLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMBLOB);
ALTER TABLE t1 MODIFY a MEDIUMBLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a BLOB);
ALTER TABLE t1 MODIFY a BLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a LONGBLOB);
ALTER TABLE t1 MODIFY a LONGBLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10));
ALTER TABLE t1 MODIFY a CHAR(10), ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10));
ALTER TABLE t1 MODIFY a VARCHAR(10), ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a TINYTEXT);
ALTER TABLE t1 MODIFY a TINYTEXT, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT);
ALTER TABLE t1 MODIFY a MEDIUMTEXT, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a TEXT);
ALTER TABLE t1 MODIFY a TEXT, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT);
ALTER TABLE t1 MODIFY a LONGTEXT, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10));
ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_bin, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10));
ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_bin, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a TINYTEXT);
ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT);
ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a TEXT);
ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT);
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10) COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a TINYTEXT COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a TEXT COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT COLLATE latin1_bin);
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10) COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a TINYTEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a TEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
#
# Start of 10.1 tests
#
#
# MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB
#
CREATE TABLE t1 (a TINYBLOB);
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMBLOB);
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a BLOB);
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a LONGBLOB);
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY);
ALTER TABLE t1 MODIFY a TINYBLOB, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY);
ALTER TABLE t1 MODIFY a MEDIUMBLOB, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY);
ALTER TABLE t1 MODIFY a BLOB, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY);
ALTER TABLE t1 MODIFY a LONGBLOB, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY);
ALTER TABLE t1 MODIFY a POLYGON, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY.
DROP TABLE t1;
CREATE TABLE t1 (a POLYGON);
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a POLYGON);
ALTER TABLE t1 MODIFY a POLYGON, ALGORITHM=INPLACE;
DROP TABLE t1;
#
# End of 10.1 tests
#
...@@ -121,3 +121,168 @@ drop table t1; ...@@ -121,3 +121,168 @@ drop table t1;
create table t1 (a int) partition by hash(a) partitions 2; create table t1 (a int) partition by hash(a) partitions 2;
alter online table t1 modify a int comment 'test'; alter online table t1 modify a int comment 'test';
drop table t1; drop table t1;
--echo #
--echo # MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB
--echo #
#
# ALTER to the same [VAR]BINARY type
#
CREATE TABLE t1 (a BINARY(10));
ALTER TABLE t1 MODIFY a BINARY(10), ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a VARBINARY(10));
ALTER TABLE t1 MODIFY a VARBINARY(10), ALGORITHM=INPLACE;
DROP TABLE t1;
#
# ALTER to the same BLOB variant
#
CREATE TABLE t1 (a TINYBLOB);
ALTER TABLE t1 MODIFY a TINYBLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMBLOB);
ALTER TABLE t1 MODIFY a MEDIUMBLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a BLOB);
ALTER TABLE t1 MODIFY a BLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a LONGBLOB);
ALTER TABLE t1 MODIFY a LONGBLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
#
# ALTER to the same [VAR]CHAR type
#
CREATE TABLE t1 (a CHAR(10));
ALTER TABLE t1 MODIFY a CHAR(10), ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10));
ALTER TABLE t1 MODIFY a VARCHAR(10), ALGORITHM=INPLACE;
DROP TABLE t1;
#
# ALTER to the same TEXT variant
#
CREATE TABLE t1 (a TINYTEXT);
ALTER TABLE t1 MODIFY a TINYTEXT, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT);
ALTER TABLE t1 MODIFY a MEDIUMTEXT, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a TEXT);
ALTER TABLE t1 MODIFY a TEXT, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT);
ALTER TABLE t1 MODIFY a LONGTEXT, ALGORITHM=INPLACE;
DROP TABLE t1;
#
# ALTER from a non-binary to a binary collation
#
CREATE TABLE t1 (a CHAR(10));
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_bin, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10));
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_bin, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a TINYTEXT);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a TEXT);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
DROP TABLE t1;
#
# ALTER from a binary to a non-binary collation
#
CREATE TABLE t1 (a CHAR(10) COLLATE latin1_bin);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_bin);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a TINYTEXT COLLATE latin1_bin);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT COLLATE latin1_bin);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a TEXT COLLATE latin1_bin);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT COLLATE latin1_bin);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1;
#
# ALTER from a non-binary collation to another non-binary collation
#
CREATE TABLE t1 (a CHAR(10) COLLATE latin1_general_ci);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_general_ci);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a TINYTEXT COLLATE latin1_general_ci);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMTEXT COLLATE latin1_general_ci);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a TEXT COLLATE latin1_general_ci);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT COLLATE latin1_general_ci);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1;
# End of 10.0 tests
--source include/have_innodb.inc
--source include/have_geometry.inc
--echo #
--echo # Start of 10.1 tests
--echo #
--echo #
--echo # MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB
--echo #
#
# Blob variants to GEOMETRY
#
CREATE TABLE t1 (a TINYBLOB);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a MEDIUMBLOB);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a BLOB);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a LONGBLOB);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
DROP TABLE t1;
#
# GEOMETRY to BLOB variants
#
CREATE TABLE t1 (a GEOMETRY);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a TINYBLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a MEDIUMBLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a BLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a LONGBLOB, ALGORITHM=INPLACE;
DROP TABLE t1;
#
# Different GEOMETRY types
#
# Can't do INPLACE from a supertype to a subtype
CREATE TABLE t1 (a GEOMETRY);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY a POLYGON, ALGORITHM=INPLACE;
DROP TABLE t1;
# Ok to do INPLACE from a subtype to a supertype
CREATE TABLE t1 (a POLYGON);
ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
DROP TABLE t1;
# Ok to do INPLACE for two equal geometry subtypes
CREATE TABLE t1 (a POLYGON);
ALTER TABLE t1 MODIFY a POLYGON, ALGORITHM=INPLACE;
DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #
...@@ -6403,9 +6403,6 @@ uint Field::is_equal(Create_field *new_field) ...@@ -6403,9 +6403,6 @@ uint Field::is_equal(Create_field *new_field)
uint Field_str::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()) && return ((new_field->sql_type == real_type()) &&
new_field->charset == field_charset && new_field->charset == field_charset &&
new_field->length == max_display_length()); new_field->length == max_display_length());
...@@ -7810,9 +7807,6 @@ uint Field_blob::max_packed_col_length(uint max_length) ...@@ -7810,9 +7807,6 @@ uint Field_blob::max_packed_col_length(uint max_length)
uint Field_blob::is_equal(Create_field *new_field) 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())) return ((new_field->sql_type == get_blob_type_from_length(max_data_length()))
&& new_field->charset == field_charset && && new_field->charset == field_charset &&
new_field->pack_length == pack_length()); new_field->pack_length == pack_length());
...@@ -7933,6 +7927,18 @@ Field::geometry_type Field_geom::geometry_type_merge(geometry_type a, ...@@ -7933,6 +7927,18 @@ Field::geometry_type Field_geom::geometry_type_merge(geometry_type a,
return Field::GEOM_GEOMETRY; 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*/ #endif /*HAVE_SPATIAL*/
/**************************************************************************** /****************************************************************************
...@@ -8336,8 +8342,7 @@ uint Field_enum::is_equal(Create_field *new_field) ...@@ -8336,8 +8342,7 @@ uint Field_enum::is_equal(Create_field *new_field)
The fields are compatible if they have the same flags, The fields are compatible if they have the same flags,
type, charset and have the same underlying length. type, charset and have the same underlying length.
*/ */
if (new_field->field_flags_are_binary() != field_flags_are_binary() || if (new_field->sql_type != real_type() ||
new_field->sql_type != real_type() ||
new_field->charset != field_charset || new_field->charset != field_charset ||
new_field->pack_length != pack_length()) new_field->pack_length != pack_length())
return IS_EQUAL_NO; return IS_EQUAL_NO;
......
...@@ -1080,10 +1080,6 @@ class Field ...@@ -1080,10 +1080,6 @@ class Field
const uchar *unpack_int64(uchar* to, const uchar *from, const uchar *from_end) const uchar *unpack_int64(uchar* to, const uchar *from, const uchar *from_end)
{ return unpack_int(to, from, from_end, 8); } { return unpack_int(to, from, from_end, 8); }
bool field_flags_are_binary()
{
return (flags & (BINCMP_FLAG | BINARY_FLAG)) != 0;
}
double pos_in_interval_val_real(Field *min, Field *max); double pos_in_interval_val_real(Field *min, Field *max);
double pos_in_interval_val_str(Field *min, Field *max, uint data_offset); double pos_in_interval_val_str(Field *min, Field *max, uint data_offset);
}; };
...@@ -2620,6 +2616,7 @@ class Field_geom :public Field_blob { ...@@ -2620,6 +2616,7 @@ class Field_geom :public Field_blob {
enum_field_types type() const { return MYSQL_TYPE_GEOMETRY; } enum_field_types type() const { return MYSQL_TYPE_GEOMETRY; }
bool match_collation_to_optimize_range() const { return false; } bool match_collation_to_optimize_range() const { return false; }
void sql_type(String &str) const; void sql_type(String &str) const;
uint is_equal(Create_field *new_field);
int store(const char *to, uint length, CHARSET_INFO *charset); int store(const char *to, uint length, CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
...@@ -2967,11 +2964,6 @@ class Create_field :public Sql_alloc ...@@ -2967,11 +2964,6 @@ class Create_field :public Sql_alloc
uint uint_geom_type, Virtual_column_info *vcol_info, uint uint_geom_type, Virtual_column_info *vcol_info,
engine_option_value *option_list, bool check_exists); engine_option_value *option_list, bool check_exists);
bool field_flags_are_binary()
{
return (flags & (BINCMP_FLAG | BINARY_FLAG)) != 0;
}
ha_storage_media field_storage_type() const ha_storage_media field_storage_type() const
{ {
return (ha_storage_media) return (ha_storage_media)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment