Debian Codegraph @

mysql-test/suite/maria/truncate.test

raw
1 #
2 # Testing of potential problems in Aria
3 #
4
5 -- source include/have_maria.inc
6 -- source include/have_partition.inc
7
8 --disable_warnings
9 --disable_query_log
10 drop table if exists t1,t2;
11 --enable_query_log
12 --enable_warnings
13
14 #
15 # LP:997460 truncate table on partitioned Aria table fails with ER_ILLEGAL_HA
16 #
17
18 CREATE TABLE t1 ( i INT ) ENGINE=Aria PARTITION BY HASH(i) PARTITIONS 2;
19 SET AUTOCOMMIT = 0;
20 TRUNCATE TABLE t1;
21 DROP TABLE t1;
22
23 #
24 # Other truncate tests
25 #
26
27 CREATE TABLE t1 ( i INT ) ENGINE=Aria;
28 CREATE TABLE t2 ( i INT ) ENGINE=Aria;
29 insert into t1 values(1);
30 lock table t1 write;
31 truncate table t1;
32 select count(*) from t1;
33 insert into t1 values(2);
34 select count(*) from t1;
35 truncate table t1;
36 select count(*) from t1;
37 insert into t1 values(3);
38 select count(*) from t1;
39 # Check that locking is still working
40 --error 1100
41 select * from t2;
42 unlock tables;
43 insert into t1 values(4);
44 select * from t1;
45 truncate t1;
46 select count(*) from t1;
47 drop table t1,t2;
48
49 #
50 # MDEV-3890
51 # Server crash inserting record on a temporary table after truncating it
52 #
53 CREATE TEMPORARY TABLE t1 ( i int) ENGINE=aria;
54 SHOW CREATE TABLE t1;
55 TRUNCATE TABLE t1;
56 INSERT INTO t1 (i) VALUES (1);
57 lock table t1 write;
58 truncate table t1;
59 unlock tables;
60 drop table t1;