Debian Codegraph @

mysql-test/suite/innodb/t/alter_primary_key.test

raw
1 --source innodb_default_row_format.inc
2 --source include/have_debug.inc
3 --source include/have_debug_sync.inc
4 --source include/test_db_charset_latin1.inc
5
6 --echo #
7 --echo # MDEV-23244 ALTER TABLE…ADD PRIMARY KEY fails to flag
8 --echo # duplicate key error from concurrent DML
9 --echo #
10
11 CREATE TABLE t0 (pk INT PRIMARY KEY) ENGINE=InnoDB;
12 CREATE TABLE t1 (c CHAR(2) NOT NULL) ENGINE=InnoDB;
13 INSERT INTO t1 VALUES('cd');
14
15 connect (con1,localhost,root,,);
16 BEGIN;
17 INSERT INTO t0 VALUES(1);
18
19 connection default;
20 SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done';
21 send ALTER TABLE t1 ADD PRIMARY KEY(c(1));
22
23 connection con1;
24 SET DEBUG_SYNC='now WAIT_FOR dml';
25 INSERT INTO t1 VALUES ('ab'),('ac');
26 COMMIT;
27 SET DEBUG_SYNC='now SIGNAL dml_done';
28 disconnect con1;
29
30 connection default;
31 --error ER_DUP_ENTRY
32 reap;
33 SET DEBUG_SYNC='RESET';
34
35 SELECT * FROM t1;
36 DROP TABLE t0,t1;
37
38 --source include/test_db_charset_restore.inc
39
40 --echo #
41 --echo # MDEV-35419 Server crashes when a adding column to the table which has a primary key using hash
42 --echo #
43 # it's not really using hash, it ignores the declaration
44 # for ALTER from MEMORY and back to be possible
45 create table t1 (a int,primary key using hash (a)) engine=innodb;
46 alter table t1 add b int;
47 drop table t1;
48
49 --echo # End of 11.7 tests