summaryrefslogtreecommitdiff
path: root/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result')
-rw-r--r--mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result164
1 files changed, 164 insertions, 0 deletions
diff --git a/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result b/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result
index 49ccc7b1808..952f4136cb6 100644
--- a/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result
+++ b/mysql-test/suite/parts/r/partition_mgm_lc1_innodb.result
@@ -882,6 +882,170 @@ TableA CREATE TABLE `tablea` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
# Cleaning up after LIST PARTITIONING test
DROP TABLE TableA;
+# Testing TRUNCATE PARTITION
+CREATE TABLE t1
+(a BIGINT AUTO_INCREMENT PRIMARY KEY,
+b VARCHAR(255))
+ENGINE = 'InnoDB'
+PARTITION BY RANGE (a)
+(PARTITION LT1000 VALUES LESS THAN (1000),
+PARTITION LT2000 VALUES LESS THAN (2000),
+PARTITION MAX VALUES LESS THAN MAXVALUE);
+INSERT INTO t1 VALUES (NULL, "First"), (NULL, "Second"), (999, "Last in LT1000"), (NULL, "First in LT2000"), (NULL, "Second in LT2000"), (1999, "Last in LT2000"), (NULL, "First in MAX"), (NULL, "Second in MAX");
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) NOT NULL AUTO_INCREMENT,
+ `b` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY RANGE (a)
+(PARTITION LT1000 VALUES LESS THAN (1000) ENGINE = InnoDB,
+ PARTITION LT2000 VALUES LESS THAN (2000) ENGINE = InnoDB,
+ PARTITION MAX VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
+SELECT * FROM t1 ORDER BY a;
+a b
+1 First
+2 Second
+999 Last in LT1000
+1000 First in LT2000
+1001 Second in LT2000
+1999 Last in LT2000
+2000 First in MAX
+2001 Second in MAX
+ALTER TABLE t1 ANALYZE PARTITION MAX;
+Table Op Msg_type Msg_text
+mysql_test_db.t1 analyze status OK
+# Truncate without FLUSH
+ALTER TABLE t1 TRUNCATE PARTITION MAX;
+INSERT INTO t1 VALUES (NULL, "First after TRUNCATE MAX (1)");
+SELECT * FROM t1 WHERE a >= 2000;
+a b
+2000 First after TRUNCATE MAX (1)
+# Truncate with FLUSH after
+ALTER TABLE t1 TRUNCATE PARTITION MAX;
+FLUSH TABLES;
+INSERT INTO t1 VALUES (NULL, "First after TRUNCATE MAX (2)");
+SELECT * FROM t1 WHERE a >= 2000;
+a b
+2000 First after TRUNCATE MAX (2)
+# Truncate with FLUSH before
+FLUSH TABLES;
+ALTER TABLE t1 TRUNCATE PARTITION MAX;
+INSERT INTO t1 VALUES (NULL, "First after TRUNCATE MAX (3)");
+SELECT * FROM t1 WHERE a >= 2000;
+a b
+2000 First after TRUNCATE MAX (3)
+# Truncate with FLUSH after INSERT
+FLUSH TABLES;
+ALTER TABLE t1 TRUNCATE PARTITION MAX;
+INSERT INTO t1 VALUES (NULL, "First after TRUNCATE MAX (4)");
+SELECT * FROM t1 WHERE a >= 2000;
+a b
+2000 First after TRUNCATE MAX (4)
+# Truncate without FLUSH
+ALTER TABLE t1 TRUNCATE PARTITION LT1000;
+INSERT INTO t1 VALUES (NULL, "First after TRUNCATE LT1000 (1)");
+SELECT * FROM t1 ORDER BY a;
+a b
+1000 First in LT2000
+1001 Second in LT2000
+1999 Last in LT2000
+2000 First after TRUNCATE MAX (4)
+2001 First after TRUNCATE LT1000 (1)
+# Truncate with FLUSH after
+ALTER TABLE t1 TRUNCATE PARTITION LT1000;
+FLUSH TABLES;
+INSERT INTO t1 VALUES (NULL, "First after TRUNCATE LT1000 (2)");
+SELECT * FROM t1 ORDER BY a;
+a b
+1000 First in LT2000
+1001 Second in LT2000
+1999 Last in LT2000
+2000 First after TRUNCATE MAX (4)
+2001 First after TRUNCATE LT1000 (1)
+2002 First after TRUNCATE LT1000 (2)
+# Truncate with FLUSH before
+FLUSH TABLES;
+ALTER TABLE t1 TRUNCATE PARTITION LT1000;
+INSERT INTO t1 VALUES (NULL, "First after TRUNCATE LT1000 (3)");
+SELECT * FROM t1 ORDER BY a;
+a b
+1000 First in LT2000
+1001 Second in LT2000
+1999 Last in LT2000
+2000 First after TRUNCATE MAX (4)
+2001 First after TRUNCATE LT1000 (1)
+2002 First after TRUNCATE LT1000 (2)
+2003 First after TRUNCATE LT1000 (3)
+# Truncate with FLUSH after INSERT
+FLUSH TABLES;
+ALTER TABLE t1 TRUNCATE PARTITION LT1000;
+INSERT INTO t1 VALUES (NULL, "First after TRUNCATE LT1000 (4)");
+SELECT * FROM t1 ORDER BY a;
+a b
+1000 First in LT2000
+1001 Second in LT2000
+1999 Last in LT2000
+2000 First after TRUNCATE MAX (4)
+2001 First after TRUNCATE LT1000 (1)
+2002 First after TRUNCATE LT1000 (2)
+2003 First after TRUNCATE LT1000 (3)
+2004 First after TRUNCATE LT1000 (4)
+# Truncate without FLUSH
+ALTER TABLE t1 TRUNCATE PARTITION LT2000;
+INSERT INTO t1 VALUES (NULL, "First after TRUNCATE LT2000 (1)");
+SELECT * FROM t1 ORDER BY a;
+a b
+2000 First after TRUNCATE MAX (4)
+2001 First after TRUNCATE LT1000 (1)
+2002 First after TRUNCATE LT1000 (2)
+2003 First after TRUNCATE LT1000 (3)
+2004 First after TRUNCATE LT1000 (4)
+2005 First after TRUNCATE LT2000 (1)
+# Truncate with FLUSH after
+ALTER TABLE t1 TRUNCATE PARTITION LT2000;
+FLUSH TABLES;
+INSERT INTO t1 VALUES (NULL, "First after TRUNCATE LT2000 (2)");
+SELECT * FROM t1 ORDER BY a;
+a b
+2000 First after TRUNCATE MAX (4)
+2001 First after TRUNCATE LT1000 (1)
+2002 First after TRUNCATE LT1000 (2)
+2003 First after TRUNCATE LT1000 (3)
+2004 First after TRUNCATE LT1000 (4)
+2005 First after TRUNCATE LT2000 (1)
+2006 First after TRUNCATE LT2000 (2)
+# Truncate with FLUSH before
+FLUSH TABLES;
+ALTER TABLE t1 TRUNCATE PARTITION LT2000;
+INSERT INTO t1 VALUES (NULL, "First after TRUNCATE LT2000 (3)");
+SELECT * FROM t1 ORDER BY a;
+a b
+2000 First after TRUNCATE MAX (4)
+2001 First after TRUNCATE LT1000 (1)
+2002 First after TRUNCATE LT1000 (2)
+2003 First after TRUNCATE LT1000 (3)
+2004 First after TRUNCATE LT1000 (4)
+2005 First after TRUNCATE LT2000 (1)
+2006 First after TRUNCATE LT2000 (2)
+2007 First after TRUNCATE LT2000 (3)
+# Truncate with FLUSH after INSERT
+FLUSH TABLES;
+ALTER TABLE t1 TRUNCATE PARTITION LT2000;
+INSERT INTO t1 VALUES (NULL, "First after TRUNCATE LT2000 (4)");
+SELECT * FROM t1 ORDER BY a;
+a b
+2000 First after TRUNCATE MAX (4)
+2001 First after TRUNCATE LT1000 (1)
+2002 First after TRUNCATE LT1000 (2)
+2003 First after TRUNCATE LT1000 (3)
+2004 First after TRUNCATE LT1000 (4)
+2005 First after TRUNCATE LT2000 (1)
+2006 First after TRUNCATE LT2000 (2)
+2007 First after TRUNCATE LT2000 (3)
+2008 First after TRUNCATE LT2000 (4)
+DROP TABLE t1;
# Cleaning up before exit
USE test;
DROP DATABASE MySQL_Test_DB;