Commit 7e29f2d6 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB

parent 19937802
...@@ -65,3 +65,117 @@ create table t3 (a int not null primary key, b int, c varchar(80)) engine=merge ...@@ -65,3 +65,117 @@ create table t3 (a int not null primary key, b int, c varchar(80)) engine=merge
alter online table t3 union=(t1,t2); alter online table t3 union=(t1,t2);
ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE. ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
drop table t1,t2,t3; drop table t1,t2,t3;
#
# 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;
#
# End of MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB
#
#
# 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
#
...@@ -104,3 +104,170 @@ create table t3 (a int not null primary key, b int, c varchar(80)) engine=merge ...@@ -104,3 +104,170 @@ create table t3 (a int not null primary key, b int, c varchar(80)) engine=merge
--error ER_ALTER_OPERATION_NOT_SUPPORTED --error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t3 union=(t1,t2); alter online table t3 union=(t1,t2);
drop table t1,t2,t3; drop table t1,t2,t3;
--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;
--echo #
--echo # End of MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB
--echo #
--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 #
...@@ -6887,9 +6887,6 @@ uint Field::is_equal(Create_field *new_field) ...@@ -6887,9 +6887,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());
...@@ -8263,9 +8260,6 @@ uint Field_blob::max_packed_col_length(uint max_length) ...@@ -8263,9 +8260,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());
...@@ -8485,6 +8479,19 @@ Field::geometry_type Field_geom::geometry_type_merge(geometry_type a, ...@@ -8485,6 +8479,19 @@ Field::geometry_type Field_geom::geometry_type_merge(geometry_type a,
} }
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);
}
bool Field_geom::can_optimize_range(const Item_bool_func *cond, bool Field_geom::can_optimize_range(const Item_bool_func *cond,
const Item *item, const Item *item,
bool is_eq_func) const bool is_eq_func) const
...@@ -8896,8 +8903,7 @@ uint Field_enum::is_equal(Create_field *new_field) ...@@ -8896,8 +8903,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;
......
...@@ -1448,10 +1448,6 @@ protected: ...@@ -1448,10 +1448,6 @@ protected:
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);
}; };
...@@ -3130,6 +3126,7 @@ public: ...@@ -3130,6 +3126,7 @@ public:
const Item *item, const Item *item,
bool is_eq_func) const; bool is_eq_func) const;
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);
...@@ -3503,11 +3500,6 @@ public: ...@@ -3503,11 +3500,6 @@ public:
bool check(THD *thd); bool check(THD *thd);
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