mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-27244 Table corruption upon adding serial data type
MDEV-25803 excluded some cases from key sort upon alter table. That particularly depends on ALTER_ADD_INDEX flag. Creating a column of SERIAL data type missed that flag. Though equivalent operation alter table t1 add x bigint unsigned not null auto_increment unique; has ALTER_ADD_INDEX flag.
This commit is contained in:
@ -746,4 +746,13 @@ explain partitions select * from t1;
|
|||||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 pn # NULL NULL NULL NULL # #
|
1 SIMPLE t1 pn # NULL NULL NULL NULL # #
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-27244 Table corruption upon adding serial data type
|
||||||
|
#
|
||||||
|
create table t1 (f int, key(f)) with system versioning
|
||||||
|
partition by system_time limit 10 (partition p0 history, partition pn current);
|
||||||
|
alter table t1 add x serial;
|
||||||
|
alter table t1 add partition (partition p1 history);
|
||||||
|
alter table t1 add partition (partition p2 history);
|
||||||
|
drop table t1;
|
||||||
# End of 10.3 tests
|
# End of 10.3 tests
|
||||||
|
@ -727,6 +727,16 @@ explain partitions select * from t1 for system_time as of '2000-01-01 02:00:00';
|
|||||||
explain partitions select * from t1;
|
explain partitions select * from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-27244 Table corruption upon adding serial data type
|
||||||
|
--echo #
|
||||||
|
create table t1 (f int, key(f)) with system versioning
|
||||||
|
partition by system_time limit 10 (partition p0 history, partition pn current);
|
||||||
|
alter table t1 add x serial;
|
||||||
|
alter table t1 add partition (partition p1 history);
|
||||||
|
alter table t1 add partition (partition p2 history);
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
--echo # End of 10.3 tests
|
--echo # End of 10.3 tests
|
||||||
|
|
||||||
--source suite/versioning/common_finish.inc
|
--source suite/versioning/common_finish.inc
|
||||||
|
@ -6783,6 +6783,7 @@ field_type_or_serial:
|
|||||||
Lex->last_field->set_handler(&type_handler_longlong);
|
Lex->last_field->set_handler(&type_handler_longlong);
|
||||||
Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG
|
Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG
|
||||||
| UNSIGNED_FLAG | UNIQUE_KEY_FLAG;
|
| UNSIGNED_FLAG | UNIQUE_KEY_FLAG;
|
||||||
|
Lex->alter_info.flags|= ALTER_ADD_INDEX;
|
||||||
}
|
}
|
||||||
opt_serial_attribute
|
opt_serial_attribute
|
||||||
;
|
;
|
||||||
|
@ -6625,6 +6625,7 @@ field_type_or_serial:
|
|||||||
Lex->last_field->set_handler(&type_handler_longlong);
|
Lex->last_field->set_handler(&type_handler_longlong);
|
||||||
Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG
|
Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG
|
||||||
| UNSIGNED_FLAG | UNIQUE_KEY_FLAG;
|
| UNSIGNED_FLAG | UNIQUE_KEY_FLAG;
|
||||||
|
Lex->alter_info.flags|= ALTER_ADD_INDEX;
|
||||||
}
|
}
|
||||||
opt_serial_attribute
|
opt_serial_attribute
|
||||||
;
|
;
|
||||||
|
Reference in New Issue
Block a user