1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-24763 ALTER TABLE fails to rename a column in SYS_FIELDS

innobase_rename_column_try(): When renaming SYS_FIELDS records
for secondary indexes, try to use both formats of SYS_FIELDS.POS
as keys, in case the PRIMARY KEY includes a column prefix.

Without this fix, an ALTER TABLE that renames a column followed
by a server restart (or LRU eviction of the table definition
from dict_sys) would make the table inaccessible.
This commit is contained in:
Marko Mäkelä
2021-02-12 09:48:36 +02:00
parent 028ba10d0b
commit 6f3f191cfa
3 changed files with 65 additions and 0 deletions

View File

@ -70,3 +70,19 @@ ERROR HY000: Tablespace has been discarded for table `t`
ALTER TABLE t FORCE;
ERROR HY000: Tablespace has been discarded for table `t`
DROP TABLE t;
#
# MDEV-24763 ALTER TABLE fails to rename a column in SYS_FIELDS
#
CREATE TABLE t1 (a INT, b TEXT, c INT, PRIMARY KEY(b(9)), INDEX(c,a))
ENGINE=InnoDB;
ALTER TABLE t1 CHANGE COLUMN a u INT;
SELECT sf.* FROM information_schema.innodb_sys_fields sf
INNER JOIN information_schema.innodb_sys_indexes si ON sf.index_id=si.index_id
INNER JOIN information_schema.innodb_sys_tables st ON si.table_id=st.table_id
WHERE st.name='test/t1' ORDER BY pos;
INDEX_ID NAME POS
ID b 0
ID c 0
ID u 1
DROP TABLE t1;
# End of 10.2 tests