File: alter_primary_key.test

package info (click to toggle)
mariadb 1%3A11.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 765,428 kB
  • sloc: ansic: 2,382,827; cpp: 1,803,532; asm: 378,315; perl: 63,176; sh: 46,496; pascal: 40,776; java: 39,363; yacc: 20,428; python: 19,506; sql: 17,864; xml: 12,463; ruby: 8,544; makefile: 6,059; cs: 5,855; ada: 1,700; lex: 1,193; javascript: 1,039; objc: 80; tcl: 73; awk: 46; php: 22
file content (49 lines) | stat: -rw-r--r-- 1,296 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--source innodb_default_row_format.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/test_db_charset_latin1.inc

--echo #
--echo # MDEV-23244 ALTER TABLE…ADD PRIMARY KEY fails to flag
--echo # duplicate key error from concurrent DML
--echo #

CREATE TABLE t0 (pk INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t1 (c CHAR(2) NOT NULL) ENGINE=InnoDB;
INSERT INTO  t1 VALUES('cd');

connect (con1,localhost,root,,);
BEGIN;
INSERT INTO t0 VALUES(1);

connection default;
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done';
send ALTER TABLE t1 ADD PRIMARY KEY(c(1));

connection con1;
SET DEBUG_SYNC='now WAIT_FOR dml';
INSERT INTO t1 VALUES ('ab'),('ac');
COMMIT;
SET DEBUG_SYNC='now SIGNAL dml_done';
disconnect con1;

connection default;
--error ER_DUP_ENTRY
reap;
SET DEBUG_SYNC='RESET';

SELECT * FROM t1;
DROP TABLE t0,t1;

--source include/test_db_charset_restore.inc

--echo #
--echo # MDEV-35419 Server crashes when a adding column to the table which has a primary key using hash
--echo #
# it's not really using hash, it ignores the declaration
# for ALTER from MEMORY and back to be possible
create table t1 (a int,primary key using hash (a)) engine=innodb;
alter table t1 add b int;
drop table t1;

--echo # End of 11.7 tests