# # Basic CREATE TABLE .. PARTITION statements # --source include/have_partition.inc --source ../have_engine.inc --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings let $create_definition = a $int_col; let $partition_options = PARTITION BY HASH(a) PARTITIONS 2; --source ../create_table.inc if ($mysql_errname) { --let $my_last_stmt = $create_statement --let $functionality = Partitions --source ../unexpected_result.inc } if (!$mysql_errname) { INSERT INTO t1 (a) VALUES (1),(2),(3),(2); # We are only interested in partition information --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 # EXPLAIN PARTITIONS SELECT a FROM t1; --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 # EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2; DROP TABLE t1; } let $create_definition = a $char_col; let $partition_options = PARTITION BY KEY(a) PARTITIONS 2; --source ../create_table.inc if ($mysql_errname) { --let $my_last_stmt = $create_statement --let $functionality = Partitions or CHAR types --source ../unexpected_result.inc } if (!$mysql_errname) { INSERT INTO t1 (a) VALUES ('a'),('b'),('c'); --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 # EXPLAIN PARTITIONS SELECT a FROM t1; --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 # EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 'b'; DROP TABLE t1; } --let $continue = 1 --source ../have_default_index.inc if ($have_default_index) { let $create_definition = a $int_indexed_col, $default_index (a); let $partition_options = PARTITION BY KEY(a) PARTITIONS 2; --source ../create_table.inc if ($mysql_errname) { --let $my_last_stmt = $create_statement --let $functionality = Partitions or indexes --source ../unexpected_result.inc } if (!$mysql_errname) { --source ../mask_engine.inc --replace_column 6 # 7 # 10 # 11 # SHOW INDEX IN t1; INSERT INTO t1 (a) VALUES (1),(2),(3),(5); --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 # EXPLAIN PARTITIONS SELECT a FROM t1; --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 # EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a IN (1,3); DROP TABLE t1; } } let $create_definition = a $int_indexed_col PRIMARY KEY; let $partition_options = PARTITION BY KEY() PARTITIONS 2; --source ../create_table.inc if ($mysql_errname) { --let $my_last_stmt = $create_statement --let $functionality = PK --source ../unexpected_result.inc } if (!$mysql_errname) { --replace_column 6 # 7 # 10 # 11 # SHOW INDEX IN t1; INSERT INTO t1 (a) VALUES (1),(200),(3),(2); --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 # EXPLAIN PARTITIONS SELECT a FROM t1; --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 # EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2; DROP TABLE t1; } let $create_definition = a $int_col; let $partition_options = PARTITION BY RANGE(a) ( PARTITION p0 VALUES LESS THAN (10), PARTITION p1 VALUES LESS THAN (1000) ); --source ../create_table.inc if ($mysql_errname) { --let $my_last_stmt = $create_statement --let $functionality = Partitions --source ../unexpected_result.inc } if (!$mysql_errname) { INSERT INTO t1 (a) VALUES (1),(2),(400); --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 # EXPLAIN PARTITIONS SELECT a FROM t1; --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 # EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 2; --let $error_codes = ER_NO_PARTITION_FOR_GIVEN_VALUE INSERT INTO t1 (a) VALUES (10000); --source ../check_errors.inc DROP TABLE t1; let $create_definition = a $int_col; let $partition_options = PARTITION BY LIST(a) ( PARTITION abc VALUES IN (1,2,3), PARTITION def VALUES IN (100,101,102) ); --source ../create_table.inc INSERT INTO t1 (a) VALUES (1),(101),(1); --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 # EXPLAIN PARTITIONS SELECT a FROM t1; --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 # EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100; --let $error_codes = ER_NO_PARTITION_FOR_GIVEN_VALUE INSERT INTO t1 (a) VALUES (50); --source ../check_errors.inc DROP TABLE t1; } let $create_definition = a $int_col, b $int_col; let partition_options = PARTITION BY LIST(a) SUBPARTITION by HASH(b) ( PARTITION abc VALUES IN (1,2,3), PARTITION def VALUES IN (100,101,102) ); --source ../create_table.inc if ($mysql_errname) { --let $my_last_stmt = $create_statement --let $functionality = Partitions or subpartitions --source ../unexpected_result.inc } if (!$mysql_errname) { --replace_column 6 # 7 # 10 # 11 # SHOW INDEX IN t1; INSERT INTO t1 (a,b) VALUES (1,1),(101,2),(1,3); --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 # EXPLAIN PARTITIONS SELECT a FROM t1; --replace_column 5 # 6 # 7 # 8 # 9 # 10 # 11 # EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100; --sorted_result SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, SUBPARTITION_NAME, PARTITION_METHOD, SUBPARTITION_METHOD FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1'; # This is just to hit some more handler functions while we are here --disable_result_log SELECT * FROM INFORMATION_SCHEMA.PARTITIONS; --enable_result_log DROP TABLE t1; } --source ../cleanup_engine.inc