| 1 |
-- source include/have_innodb.inc |
| 2 |
# embedded server does not support restarting |
| 3 |
-- source include/not_embedded.inc |
| 4 |
|
| 5 |
# Before MDEV-6076 Persistent AUTO_INCREMENT for InnoDB |
| 6 |
# this was a test for |
| 7 |
# Bug #44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from |
| 8 |
# the index (PRIMARY) |
| 9 |
# This test requires a restart of the server |
| 10 |
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; |
| 11 |
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; |
| 12 |
INSERT INTO t1 VALUES (null); |
| 13 |
INSERT INTO t1 VALUES (null); |
| 14 |
--enable_info |
| 15 |
ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; |
| 16 |
--disable_info |
| 17 |
SELECT * FROM t1; |
| 18 |
-- source include/restart_mysqld.inc |
| 19 |
SHOW CREATE TABLE t1; |
| 20 |
INSERT INTO t1 VALUES(null); |
| 21 |
SELECT * FROM t1; |
| 22 |
|
| 23 |
# Before WL#5534, the following statement would copy the table, |
| 24 |
# and effectively set AUTO_INCREMENT to 4, because while copying |
| 25 |
# it would write values 1,2,3 to the column. |
| 26 |
# WL#5534 makes this an in-place ALTER, setting AUTO_INCREMENT=3 for real. |
| 27 |
# However, to keep compatibility with ALGORITHM=COPY MySQL 5.6.11 will |
| 28 |
# go back to the original behaviour, setting AUTO_INCREMENT to 4. |
| 29 |
--enable_info |
| 30 |
ALTER TABLE t1 AUTO_INCREMENT = 3; |
| 31 |
--disable_info |
| 32 |
SHOW CREATE TABLE t1; |
| 33 |
INSERT INTO t1 VALUES(null); |
| 34 |
INSERT INTO t1 VALUES(null); |
| 35 |
SELECT * FROM t1; |
| 36 |
DROP TABLE t1; |