Debian Codegraph @

mysql-test/suite/innodb/include/autoinc_persist_alter.inc

raw
1
2 eval CREATE TABLE $table LIKE $template;
3
4 eval INSERT INTO $table SELECT * FROM $template;
5
6 eval SELECT * FROM $table;
7
8 eval SHOW CREATE TABLE $table;
9
10 --echo # This will keep the autoinc counter
11 eval ALTER TABLE $table AUTO_INCREMENT = 250, ALGORITHM = $algorithm;
12 --echo # We expect the counter to be 250
13 eval SHOW CREATE TABLE $table;
14
15 --echo # This should keep the autoinc counter as well
16 eval ALTER TABLE $table ADD COLUMN b INT, ALGORITHM = $algorithm;
17 --echo # We expect the counter to be 250
18 eval SHOW CREATE TABLE $table;
19
20 eval DELETE FROM $table WHERE a > 150;
21
22 eval SELECT * FROM $table;
23
24 --echo # This should reset the autoinc counter to the one specified
25 --echo # Since it's smaller than current one but bigger than existing
26 --echo # biggest counter in the table
27 eval ALTER TABLE $table AUTO_INCREMENT = 180, ALGORITHM = $algorithm;
28 --echo # We expect the counter to be 180
29 eval SHOW CREATE TABLE $table;
30
31 --echo # This should reset the autoinc counter to the next value of
32 --echo # current max counter in the table, since the specified value
33 --echo # is smaller than the existing biggest value(50 < 123)
34 eval ALTER TABLE $table DROP COLUMN b, AUTO_INCREMENT = 50, ALGORITHM = $algorithm;
35 --echo # We expect the counter to be 123
36 eval SHOW CREATE TABLE $table;
37
38 eval INSERT INTO $table VALUES(0), (0);
39
40 eval SELECT MAX(a) AS `Expect 124` FROM $table;
41
42 eval OPTIMIZE TABLE $table;
43
44 eval SHOW CREATE TABLE $table;
45
46 --source include/restart_mysqld.inc
47
48 --echo # We expect the counter to still be 125
49 eval SHOW CREATE TABLE $table;
50
51 eval DELETE FROM $table WHERE a >= 123;
52
53 eval CREATE UNIQUE INDEX idx_aa ON $table(a);
54
55 --source include/restart_mysqld.inc
56
57 eval INSERT INTO $table VALUES(0), (0);
58
59 eval SELECT MAX(a) AS `Expect 126` FROM $table;
60
61 eval DROP TABLE $table;