1# We use a separate test wrapper for engines not supporting native partitioning
2# since the test results will be different due to deprecation warnings. This test
3# expects to either be executed directly with InnoDB as default engine, or to be
4# executed indirectly by being included in a test wrapper  setting the ENGINE
5# variable.
6--disable_warnings
7if (!$ENGINE)
8{
9  let $ENGINE=`SELECT variable_value FROM performance_schema.global_variables
10               WHERE variable_name = 'DEFAULT_STORAGE_ENGINE'`;
11  if ($ENGINE != "InnoDB")
12  {
13    skip Engines not supporting native partitioning are tested using a test wrapper;
14  }
15}
16--enable_warnings
17
18--disable_warnings
19DROP TABLE IF EXISTS t1;
20--enable_warnings
21 CREATE TABLE t1 ( c1 INTEGER NOT NULL PRIMARY KEY, c2 CHAR(10)) PARTITION BY RANGE (c1) (
22    PARTITION p0 VALUES LESS THAN (100),
23    PARTITION p1 VALUES LESS THAN (200),
24    PARTITION p2 VALUES LESS THAN (300),
25    PARTITION p3 VALUES LESS THAN (400),
26    PARTITION p4 VALUES LESS THAN (500),
27    PARTITION p5 VALUES LESS THAN MAXVALUE);
28SHOW TABLES;
29INSERT INTO t1 VALUES(0,'abc'),(100,'abc'),(200,'abc'),(300,'abc'),(400,'abc');
30SELECT * FROM t1 ORDER BY c1;
31--replace_result $ENGINE ENGINE
32SHOW CREATE TABLE t1;
33--disable_result_log
34#the output depends on engine (engine dependent)
35ALTER TABLE t1 OPTIMIZE PARTITION p1,p2;
36--enable_result_log
37SELECT * FROM t1 ORDER BY c1;
38--replace_result $ENGINE ENGINE
39 SHOW CREATE TABLE t1;
40 DROP TABLE t1; SHOW TABLES;
41
42