Commit 785e2248 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-13089 identifier quoting in partitioning

don't print partitioning expression as it was entered by the user,
use Item::print() according to the sql_mode and sql_quote_show_create
parent 504eff0c
...@@ -6,7 +6,7 @@ Table Create Table ...@@ -6,7 +6,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY KEY (c1) PARTITION BY KEY (`c1`)
PARTITIONS 3 PARTITIONS 3
INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å'); INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å');
INSERT INTO t1 VALUES ('B'); INSERT INTO t1 VALUES ('B');
......
...@@ -7,9 +7,9 @@ partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3); ...@@ -7,9 +7,9 @@ partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
select * from information_schema.partitions where table_schema="test" select * from information_schema.partitions where table_schema="test"
and table_name="t1"; and table_name="t1";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
def test t1 x1 NULL 1 NULL LIST NULL b*a NULL 1 0 0 0 # 1024 0 # # NULL NULL default ts1 def test t1 x1 NULL 1 NULL LIST NULL `b` * `a` NULL 1 0 0 0 # 1024 0 # # NULL NULL default ts1
def test t1 x2 NULL 2 NULL LIST NULL b*a NULL 3,11,5,7 0 0 0 # 1024 0 # # NULL NULL default ts2 def test t1 x2 NULL 2 NULL LIST NULL `b` * `a` NULL 3,11,5,7 0 0 0 # 1024 0 # # NULL NULL default ts2
def test t1 x3 NULL 3 NULL LIST NULL b*a NULL 16,8,24,27 0 0 0 # 1024 0 # # NULL NULL default ts3 def test t1 x3 NULL 3 NULL LIST NULL `b` * `a` NULL 16,8,24,27 0 0 0 # 1024 0 # # NULL NULL default ts3
create table t2 (a int not null,b int not null,c int not null, primary key(a,b)) create table t2 (a int not null,b int not null,c int not null, primary key(a,b))
partition by range (a) partition by range (a)
partitions 3 partitions 3
...@@ -19,18 +19,18 @@ partition x3 values less than maxvalue tablespace ts3); ...@@ -19,18 +19,18 @@ partition x3 values less than maxvalue tablespace ts3);
select * from information_schema.partitions where table_schema="test" select * from information_schema.partitions where table_schema="test"
and table_name="t2"; and table_name="t2";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
def test t2 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 1024 0 # # NULL NULL default ts1 def test t2 x1 NULL 1 NULL RANGE NULL `a` NULL 5 0 0 0 # 1024 0 # # NULL NULL default ts1
def test t2 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 1024 0 # # NULL NULL default ts2 def test t2 x2 NULL 2 NULL RANGE NULL `a` NULL 10 0 0 0 # 1024 0 # # NULL NULL default ts2
def test t2 x3 NULL 3 NULL RANGE NULL a NULL MAXVALUE 0 0 0 # 1024 0 # # NULL NULL default ts3 def test t2 x3 NULL 3 NULL RANGE NULL `a` NULL MAXVALUE 0 0 0 # 1024 0 # # NULL NULL default ts3
create table t3 (f1 date) create table t3 (f1 date)
partition by hash(month(f1)) partition by hash(month(f1))
partitions 3; partitions 3;
select * from information_schema.partitions where table_schema="test" select * from information_schema.partitions where table_schema="test"
and table_name="t3"; and table_name="t3";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
def test t3 p0 NULL 1 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL def test t3 p0 NULL 1 NULL HASH NULL month(`f1`) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
def test t3 p1 NULL 2 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL def test t3 p1 NULL 2 NULL HASH NULL month(`f1`) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
def test t3 p2 NULL 3 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL def test t3 p2 NULL 3 NULL HASH NULL month(`f1`) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
create table t4 (f1 date, f2 int) create table t4 (f1 date, f2 int)
partition by key(f1,f2) partition by key(f1,f2)
partitions 3; partitions 3;
...@@ -63,14 +63,14 @@ subpartition x22 tablespace t2) ...@@ -63,14 +63,14 @@ subpartition x22 tablespace t2)
); );
select * from information_schema.partitions where table_schema="test"; select * from information_schema.partitions where table_schema="test";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
def test t1 x1 x11 1 1 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default t1 def test t1 x1 x11 1 1 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL default t1
def test t1 x1 x12 1 2 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default t2 def test t1 x1 x12 1 2 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL default t2
def test t1 x2 x21 2 1 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default t1 def test t1 x2 x21 2 1 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL default t1
def test t1 x2 x22 2 2 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default t2 def test t1 x2 x22 2 2 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL default t2
def test t2 x1 x11 1 1 RANGE KEY a `a` 1 0 0 0 # 1024 0 # # NULL NULL default t1 def test t2 x1 x11 1 1 RANGE KEY `a` `a` 1 0 0 0 # 1024 0 # # NULL NULL default t1
def test t2 x1 x12 1 2 RANGE KEY a `a` 1 0 0 0 # 1024 0 # # NULL NULL default t2 def test t2 x1 x12 1 2 RANGE KEY `a` `a` 1 0 0 0 # 1024 0 # # NULL NULL default t2
def test t2 x2 x21 2 1 RANGE KEY a `a` 5 0 0 0 # 1024 0 # # NULL NULL default t1 def test t2 x2 x21 2 1 RANGE KEY `a` `a` 5 0 0 0 # 1024 0 # # NULL NULL default t1
def test t2 x2 x22 2 2 RANGE KEY a `a` 5 0 0 0 # 1024 0 # # NULL NULL default t2 def test t2 x2 x22 2 2 RANGE KEY `a` `a` 5 0 0 0 # 1024 0 # # NULL NULL default t2
drop table t1,t2; drop table t1,t2;
create table t1 ( create table t1 (
a int not null, a int not null,
...@@ -88,10 +88,10 @@ subpartition x22 tablespace t2 nodegroup 1) ...@@ -88,10 +88,10 @@ subpartition x22 tablespace t2 nodegroup 1)
); );
select * from information_schema.partitions where table_schema="test"; select * from information_schema.partitions where table_schema="test";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
def test t1 x1 x11 1 1 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL 0 t1 def test t1 x1 x11 1 1 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL 0 t1
def test t1 x1 x12 1 2 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL 1 t2 def test t1 x1 x12 1 2 RANGE HASH `a` `a` + `b` 1 0 0 0 # 1024 0 # # NULL NULL 1 t2
def test t1 x2 x21 2 1 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL 0 t1 def test t1 x2 x21 2 1 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL 0 t1
def test t1 x2 x22 2 2 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL 1 t2 def test t1 x2 x22 2 2 RANGE HASH `a` `a` + `b` 5 0 0 0 # 1024 0 # # NULL NULL 1 t2
show tables; show tables;
Tables_in_test Tables_in_test
t1 t1
...@@ -107,9 +107,9 @@ partitions 3; ...@@ -107,9 +107,9 @@ partitions 3;
select * from information_schema.partitions where table_schema="test" select * from information_schema.partitions where table_schema="test"
and table_name="t1"; and table_name="t1";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
def test t1 p0 NULL 1 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL def test t1 p0 NULL 1 NULL LINEAR HASH NULL month(`f1`) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
def test t1 p1 NULL 2 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL def test t1 p1 NULL 2 NULL LINEAR HASH NULL month(`f1`) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
def test t1 p2 NULL 3 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL def test t1 p2 NULL 3 NULL LINEAR HASH NULL month(`f1`) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
drop table t1; drop table t1;
create table t1 (a int) create table t1 (a int)
PARTITION BY RANGE (a) PARTITION BY RANGE (a)
...@@ -120,9 +120,9 @@ Table Create Table ...@@ -120,9 +120,9 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a) PARTITION BY RANGE (`a`)
SUBPARTITION BY LINEAR HASH (a) SUBPARTITION BY LINEAR HASH (`a`)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM) (PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM)
select SUBPARTITION_METHOD FROM information_schema.partitions WHERE select SUBPARTITION_METHOD FROM information_schema.partitions WHERE
table_schema="test" AND table_name="t1"; table_schema="test" AND table_name="t1";
SUBPARTITION_METHOD SUBPARTITION_METHOD
...@@ -138,8 +138,8 @@ Table Create Table ...@@ -138,8 +138,8 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST (a) PARTITION BY LIST (`a`)
(PARTITION p0 VALUES IN (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,50,51,52,53) ENGINE = MyISAM) (PARTITION `p0` VALUES IN (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,50,51,52,53) ENGINE = MyISAM)
SELECT PARTITION_DESCRIPTION FROM information_schema.partitions WHERE SELECT PARTITION_DESCRIPTION FROM information_schema.partitions WHERE
table_schema = "test" AND table_name = "t1"; table_schema = "test" AND table_name = "t1";
PARTITION_DESCRIPTION PARTITION_DESCRIPTION
......
This diff is collapsed.
...@@ -70,9 +70,9 @@ t1 CREATE TABLE `t1` ( ...@@ -70,9 +70,9 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`id`,`d`), PRIMARY KEY (`id`,`d`),
CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,10)) CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,10))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(d) PARTITION BY RANGE COLUMNS(`d`)
(PARTITION p1 VALUES LESS THAN ('2016-10-18') ENGINE = InnoDB, (PARTITION `p1` VALUES LESS THAN ('2016-10-18') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2020-10-19') ENGINE = InnoDB) PARTITION `p2` VALUES LESS THAN ('2020-10-19') ENGINE = InnoDB)
insert t1 values (2, '2020-01-03', 20); insert t1 values (2, '2020-01-03', 20);
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1` ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1; drop table t1;
...@@ -94,9 +94,9 @@ t1 CREATE TABLE `t1` ( ...@@ -94,9 +94,9 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`id`,`d`), PRIMARY KEY (`id`,`d`),
CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,10)) CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,10))
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(d) PARTITION BY RANGE COLUMNS(`d`)
(PARTITION p1 VALUES LESS THAN ('2016-10-18') ENGINE = MyISAM, (PARTITION `p1` VALUES LESS THAN ('2016-10-18') ENGINE = MyISAM,
PARTITION p2 VALUES LESS THAN ('2020-10-19') ENGINE = MyISAM) PARTITION `p2` VALUES LESS THAN ('2020-10-19') ENGINE = MyISAM)
insert t1 values (2, '2020-01-03', 20); insert t1 values (2, '2020-01-03', 20);
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1` ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1; drop table t1;
...@@ -23,10 +23,10 @@ t1 CREATE TABLE `t1` ( ...@@ -23,10 +23,10 @@ t1 CREATE TABLE `t1` (
`created_at` datetime NOT NULL, `created_at` datetime NOT NULL,
`cool` tinyint(4) DEFAULT 0 `cool` tinyint(4) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (TO_DAYS(created_at)) PARTITION BY RANGE (to_days(`created_at`))
(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = InnoDB, (PARTITION `month_2010_4` VALUES LESS THAN (734258) ENGINE = InnoDB,
PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = InnoDB, PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = InnoDB,
PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = InnoDB) PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
INSERT INTO t1 VALUES (1, now(), 0); INSERT INTO t1 VALUES (1, now(), 0);
flush status; flush status;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
...@@ -72,12 +72,12 @@ t1 CREATE TABLE `t1` ( ...@@ -72,12 +72,12 @@ t1 CREATE TABLE `t1` (
`created_at` datetime NOT NULL, `created_at` datetime NOT NULL,
`cool` tinyint(4) DEFAULT 0 `cool` tinyint(4) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (TO_DAYS(created_at)) PARTITION BY RANGE (to_days(`created_at`))
SUBPARTITION BY HASH (cool) SUBPARTITION BY HASH (`cool`)
SUBPARTITIONS 3 SUBPARTITIONS 3
(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = InnoDB, (PARTITION `month_2010_4` VALUES LESS THAN (734258) ENGINE = InnoDB,
PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = InnoDB, PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = InnoDB,
PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = InnoDB) PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
INSERT INTO t1 VALUES (1, now(), 0); INSERT INTO t1 VALUES (1, now(), 0);
flush status; flush status;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
......
...@@ -23,10 +23,10 @@ t1 CREATE TABLE `t1` ( ...@@ -23,10 +23,10 @@ t1 CREATE TABLE `t1` (
`created_at` datetime NOT NULL, `created_at` datetime NOT NULL,
`cool` tinyint(4) DEFAULT 0 `cool` tinyint(4) DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (TO_DAYS(created_at)) PARTITION BY RANGE (to_days(`created_at`))
(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = MyISAM, (PARTITION `month_2010_4` VALUES LESS THAN (734258) ENGINE = MyISAM,
PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = MyISAM, PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = MyISAM,
PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = MyISAM) PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
INSERT INTO t1 VALUES (1, now(), 0); INSERT INTO t1 VALUES (1, now(), 0);
flush status; flush status;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
...@@ -72,12 +72,12 @@ t1 CREATE TABLE `t1` ( ...@@ -72,12 +72,12 @@ t1 CREATE TABLE `t1` (
`created_at` datetime NOT NULL, `created_at` datetime NOT NULL,
`cool` tinyint(4) DEFAULT 0 `cool` tinyint(4) DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (TO_DAYS(created_at)) PARTITION BY RANGE (to_days(`created_at`))
SUBPARTITION BY HASH (cool) SUBPARTITION BY HASH (`cool`)
SUBPARTITIONS 3 SUBPARTITIONS 3
(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = MyISAM, (PARTITION `month_2010_4` VALUES LESS THAN (734258) ENGINE = MyISAM,
PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = MyISAM, PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = MyISAM,
PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = MyISAM) PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
INSERT INTO t1 VALUES (1, now(), 0); INSERT INTO t1 VALUES (1, now(), 0);
flush status; flush status;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
......
...@@ -30,9 +30,9 @@ t1 CREATE TABLE `t1` ( ...@@ -30,9 +30,9 @@ t1 CREATE TABLE `t1` (
`department` varchar(10) DEFAULT NULL, `department` varchar(10) DEFAULT NULL,
`country` varchar(255) DEFAULT NULL `country` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(department,country) PARTITION BY LIST COLUMNS(`department`,`country`)
(PARTITION first_office VALUES IN (('dep1','Russia'),('dep1','Croatia')) ENGINE = MyISAM, (PARTITION `first_office` VALUES IN (('dep1','Russia'),('dep1','Croatia')) ENGINE = MyISAM,
PARTITION second_office VALUES IN (('dep2','Russia')) ENGINE = MyISAM) PARTITION `second_office` VALUES IN (('dep2','Russia')) ENGINE = MyISAM)
SELECT * FROM t1 WHERE department = 'dep2' and country = 'Croatia'; SELECT * FROM t1 WHERE department = 'dep2' and country = 'Croatia';
id name department country id name department country
SELECT * FROM t1 WHERE department = 'dep1' and country = 'Croatia'; SELECT * FROM t1 WHERE department = 'dep1' and country = 'Croatia';
...@@ -173,10 +173,10 @@ Table Create Table ...@@ -173,10 +173,10 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` varchar(5) DEFAULT NULL `a` varchar(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a) PARTITION BY LIST COLUMNS(`a`)
(PARTITION p0 VALUES IN ('''') ENGINE = MyISAM, (PARTITION `p0` VALUES IN ('''') ENGINE = MyISAM,
PARTITION p1 VALUES IN ('\\') ENGINE = MyISAM, PARTITION `p1` VALUES IN ('\\') ENGINE = MyISAM,
PARTITION p2 VALUES IN ('\0') ENGINE = MyISAM) PARTITION `p2` VALUES IN ('\0') ENGINE = MyISAM)
drop table t1; drop table t1;
set @@sql_mode=allow_invalid_dates; set @@sql_mode=allow_invalid_dates;
create table t1 (a char, b char, c date) create table t1 (a char, b char, c date)
...@@ -232,13 +232,13 @@ t1 CREATE TABLE `t1` ( ...@@ -232,13 +232,13 @@ t1 CREATE TABLE `t1` (
`c` varchar(25) DEFAULT NULL, `c` varchar(25) DEFAULT NULL,
`d` datetime DEFAULT NULL `d` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(a,b,c,d) PARTITION BY RANGE COLUMNS(`a`,`b`,`c`,`d`)
SUBPARTITION BY HASH (to_seconds(d)) SUBPARTITION BY HASH (to_seconds(`d`))
SUBPARTITIONS 4 SUBPARTITIONS 4
(PARTITION p0 VALUES LESS THAN (1,'0',MAXVALUE,'1900-01-01') ENGINE = MyISAM, (PARTITION `p0` VALUES LESS THAN (1,'0',MAXVALUE,'1900-01-01') ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (1,'a',MAXVALUE,'1999-01-01') ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (1,'a',MAXVALUE,'1999-01-01') ENGINE = MyISAM,
PARTITION p2 VALUES LESS THAN (1,'b',MAXVALUE,MAXVALUE) ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (1,'b',MAXVALUE,MAXVALUE) ENGINE = MyISAM,
PARTITION p3 VALUES LESS THAN (1,MAXVALUE,MAXVALUE,MAXVALUE) ENGINE = MyISAM) PARTITION `p3` VALUES LESS THAN (1,MAXVALUE,MAXVALUE,MAXVALUE) ENGINE = MyISAM)
drop table t1; drop table t1;
create table t1 (a int, b int) create table t1 (a int, b int)
partition by range columns (a,b) partition by range columns (a,b)
...@@ -315,10 +315,10 @@ t1 CREATE TABLE `t1` ( ...@@ -315,10 +315,10 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL `b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a,b) PARTITION BY LIST COLUMNS(`a`,`b`)
(PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM, (PARTITION `p0` VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM,
PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM, PARTITION `p1` VALUES IN ((1,1),(2,2)) ENGINE = MyISAM,
PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) PARTITION `p2` VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM)
insert into t1 values (3, NULL); insert into t1 values (3, NULL);
insert into t1 values (NULL, 1); insert into t1 values (NULL, 1);
insert into t1 values (NULL, NULL); insert into t1 values (NULL, NULL);
...@@ -349,10 +349,10 @@ t1 CREATE TABLE `t1` ( ...@@ -349,10 +349,10 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL `b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a,b) PARTITION BY LIST COLUMNS(`a`,`b`)
(PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM, (PARTITION `p0` VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM,
PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM, PARTITION `p1` VALUES IN ((1,1),(2,2)) ENGINE = MyISAM,
PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM) PARTITION `p2` VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM)
drop table t1; drop table t1;
create table t1 (a int) create table t1 (a int)
partition by list (a) partition by list (a)
...@@ -366,16 +366,16 @@ partition p1 values in (4, NULL, 3)); ...@@ -366,16 +366,16 @@ partition p1 values in (4, NULL, 3));
select partition_method, partition_expression, partition_description select partition_method, partition_expression, partition_description
from information_schema.partitions where table_name = "t1"; from information_schema.partitions where table_name = "t1";
partition_method partition_expression partition_description partition_method partition_expression partition_description
LIST a 2,1 LIST `a` 2,1
LIST a NULL,4,3 LIST `a` NULL,4,3
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST (a) PARTITION BY LIST (`a`)
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM, (PARTITION `p0` VALUES IN (2,1) ENGINE = MyISAM,
PARTITION p1 VALUES IN (NULL,4,3) ENGINE = MyISAM) PARTITION `p1` VALUES IN (NULL,4,3) ENGINE = MyISAM)
insert into t1 values (1); insert into t1 values (1);
insert into t1 values (2); insert into t1 values (2);
insert into t1 values (3); insert into t1 values (3);
...@@ -403,9 +403,9 @@ Table Create Table ...@@ -403,9 +403,9 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a) PARTITION BY LIST COLUMNS(`a`)
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM, (PARTITION `p0` VALUES IN (2,1) ENGINE = MyISAM,
PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) PARTITION `p1` VALUES IN (4,NULL,3) ENGINE = MyISAM)
insert into t1 values (1); insert into t1 values (1);
insert into t1 values (2); insert into t1 values (2);
insert into t1 values (3); insert into t1 values (3);
...@@ -418,9 +418,9 @@ Table Create Table ...@@ -418,9 +418,9 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a) PARTITION BY LIST COLUMNS(`a`)
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM, (PARTITION `p0` VALUES IN (2,1) ENGINE = MyISAM,
PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM) PARTITION `p1` VALUES IN (4,NULL,3) ENGINE = MyISAM)
drop table t1; drop table t1;
create table t1 (a int, b char(10), c varchar(5), d int) create table t1 (a int, b char(10), c varchar(5), d int)
partition by range columns(a,b,c) partition by range columns(a,b,c)
...@@ -453,13 +453,13 @@ t1 CREATE TABLE `t1` ( ...@@ -453,13 +453,13 @@ t1 CREATE TABLE `t1` (
`c` varchar(5) DEFAULT NULL, `c` varchar(5) DEFAULT NULL,
`d` int(11) DEFAULT NULL `d` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(a,b,c) PARTITION BY RANGE COLUMNS(`a`,`b`,`c`)
SUBPARTITION BY KEY (c,d) SUBPARTITION BY KEY (`c`,`d`)
SUBPARTITIONS 3 SUBPARTITIONS 3
(PARTITION p0 VALUES LESS THAN (1,'abc','abc') ENGINE = MyISAM, (PARTITION `p0` VALUES LESS THAN (1,'abc','abc') ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (2,'abc','abc') ENGINE = MyISAM, PARTITION `p1` VALUES LESS THAN (2,'abc','abc') ENGINE = MyISAM,
PARTITION p2 VALUES LESS THAN (3,'abc','abc') ENGINE = MyISAM, PARTITION `p2` VALUES LESS THAN (3,'abc','abc') ENGINE = MyISAM,
PARTITION p3 VALUES LESS THAN (4,'abc','abc') ENGINE = MyISAM) PARTITION `p3` VALUES LESS THAN (4,'abc','abc') ENGINE = MyISAM)
insert into t1 values (1,'a','b',1),(2,'a','b',2),(3,'a','b',3); insert into t1 values (1,'a','b',1),(2,'a','b',2),(3,'a','b',3);
insert into t1 values (1,'b','c',1),(2,'b','c',2),(3,'b','c',3); insert into t1 values (1,'b','c',1),(2,'b','c',2),(3,'b','c',3);
insert into t1 values (1,'c','d',1),(2,'c','d',2),(3,'c','d',3); insert into t1 values (1,'c','d',1),(2,'c','d',2),(3,'c','d',3);
...@@ -486,9 +486,9 @@ t1 CREATE TABLE `t1` ( ...@@ -486,9 +486,9 @@ t1 CREATE TABLE `t1` (
`b` varchar(2) DEFAULT NULL, `b` varchar(2) DEFAULT NULL,
`c` int(11) DEFAULT NULL `c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(a,b,c) PARTITION BY RANGE COLUMNS(`a`,`b`,`c`)
(PARTITION p0 VALUES LESS THAN (1,'A',1) ENGINE = MyISAM, (PARTITION `p0` VALUES LESS THAN (1,'A',1) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (1,'B',1) ENGINE = MyISAM) PARTITION `p1` VALUES LESS THAN (1,'B',1) ENGINE = MyISAM)
insert into t1 values (1, 'A', 1); insert into t1 values (1, 'A', 1);
explain partitions select * from t1 where a = 1 AND b <= 'A' and c = 1; explain partitions select * from t1 where a = 1 AND b <= 'A' and c = 1;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
......
...@@ -329,10 +329,10 @@ t1 CREATE TABLE `t1` ( ...@@ -329,10 +329,10 @@ t1 CREATE TABLE `t1` (
`a` bit(27) NOT NULL, `a` bit(27) NOT NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (a) PARTITION BY HASH (`a`)
(PARTITION p0 ENGINE = MyISAM, (PARTITION `p0` ENGINE = MyISAM,
PARTITION p1 ENGINE = MyISAM, PARTITION `p1` ENGINE = MyISAM,
PARTITION p2 ENGINE = MyISAM) PARTITION `p2` ENGINE = MyISAM)
insert into t1 values (1),(4),(7),(10),(13),(16),(19),(22),(25),(28),(31),(34); insert into t1 values (1),(4),(7),(10),(13),(16),(19),(22),(25),(28),(31),(34);
select hex(a) from t1 where a = 7; select hex(a) from t1 where a = 7;
hex(a) hex(a)
...@@ -850,16 +850,16 @@ t2 CREATE TABLE `t2` ( ...@@ -850,16 +850,16 @@ t2 CREATE TABLE `t2` (
`a` timestamp NULL DEFAULT NULL, `a` timestamp NULL DEFAULT NULL,
`tz` varchar(16) DEFAULT NULL `tz` varchar(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (UNIX_TIMESTAMP(a)) PARTITION BY RANGE (unix_timestamp(`a`))
(PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM, (PARTITION `p0` VALUES LESS THAN (0) ENGINE = MyISAM,
PARTITION `p-2000` VALUES LESS THAN (946684800) ENGINE = MyISAM, PARTITION `p-2000` VALUES LESS THAN (946684800) ENGINE = MyISAM,
PARTITION `p-2011-MSK` VALUES LESS THAN (1301180400) ENGINE = MyISAM, PARTITION `p-2011-MSK` VALUES LESS THAN (1301180400) ENGINE = MyISAM,
PARTITION `p-2011-MSD-1` VALUES LESS THAN (1319925600) ENGINE = MyISAM, PARTITION `p-2011-MSD-1` VALUES LESS THAN (1319925600) ENGINE = MyISAM,
PARTITION `p-2011-MSD-2` VALUES LESS THAN (1319929200) ENGINE = MyISAM, PARTITION `p-2011-MSD-2` VALUES LESS THAN (1319929200) ENGINE = MyISAM,
PARTITION `p-2012-MSK-1` VALUES LESS THAN (1319932800) ENGINE = MyISAM, PARTITION `p-2012-MSK-1` VALUES LESS THAN (1319932800) ENGINE = MyISAM,
PARTITION `p-2012-MSK-2` VALUES LESS THAN (1332630000) ENGINE = MyISAM, PARTITION `p-2012-MSK-2` VALUES LESS THAN (1332630000) ENGINE = MyISAM,
PARTITION pEnd VALUES LESS THAN (2147483647) ENGINE = MyISAM, PARTITION `pEnd` VALUES LESS THAN (2147483647) ENGINE = MyISAM,
PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) PARTITION `pMax` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
TRUNCATE TABLE t2; TRUNCATE TABLE t2;
SET @@session.time_zone = 'Europe/Moscow'; SET @@session.time_zone = 'Europe/Moscow';
INSERT INTO t2 SELECT * FROM t1; INSERT INTO t2 SELECT * FROM t1;
...@@ -1334,16 +1334,16 @@ t2 CREATE TABLE `t2` ( ...@@ -1334,16 +1334,16 @@ t2 CREATE TABLE `t2` (
`a` timestamp NULL DEFAULT NULL, `a` timestamp NULL DEFAULT NULL,
`tz` varchar(16) DEFAULT NULL `tz` varchar(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (UNIX_TIMESTAMP(a)) PARTITION BY RANGE (unix_timestamp(`a`))
(PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM, (PARTITION `p0` VALUES LESS THAN (0) ENGINE = MyISAM,
PARTITION `p-2000` VALUES LESS THAN (946684800) ENGINE = MyISAM, PARTITION `p-2000` VALUES LESS THAN (946684800) ENGINE = MyISAM,
PARTITION `p-2011-MSK` VALUES LESS THAN (1301180400) ENGINE = MyISAM, PARTITION `p-2011-MSK` VALUES LESS THAN (1301180400) ENGINE = MyISAM,
PARTITION `p-2011-MSD-1` VALUES LESS THAN (1319925600) ENGINE = MyISAM, PARTITION `p-2011-MSD-1` VALUES LESS THAN (1319925600) ENGINE = MyISAM,
PARTITION `p-2011-MSD-2` VALUES LESS THAN (1319929200) ENGINE = MyISAM, PARTITION `p-2011-MSD-2` VALUES LESS THAN (1319929200) ENGINE = MyISAM,
PARTITION `p-2012-MSK-1` VALUES LESS THAN (1319932800) ENGINE = MyISAM, PARTITION `p-2012-MSK-1` VALUES LESS THAN (1319932800) ENGINE = MyISAM,
PARTITION `p-2012-MSK-2` VALUES LESS THAN (1332630000) ENGINE = MyISAM, PARTITION `p-2012-MSK-2` VALUES LESS THAN (1332630000) ENGINE = MyISAM,
PARTITION pEnd VALUES LESS THAN (2147483647) ENGINE = MyISAM, PARTITION `pEnd` VALUES LESS THAN (2147483647) ENGINE = MyISAM,
PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) PARTITION `pMax` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
TRUNCATE TABLE t2; TRUNCATE TABLE t2;
DROP TABLE t1, t2; DROP TABLE t1, t2;
SET @@session.time_zone= @old_time_zone; SET @@session.time_zone= @old_time_zone;
This diff is collapsed.
This diff is collapsed.
...@@ -8,9 +8,9 @@ Table Create Table ...@@ -8,9 +8,9 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL `a` int(11) NOT NULL
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 ) ENGINE=EXAMPLE DEFAULT CHARSET=latin1
PARTITION BY LIST (a) PARTITION BY LIST (`a`)
(PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE, (PARTITION `p0` VALUES IN (1) ENGINE = EXAMPLE,
PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) PARTITION `p1` VALUES IN (2) ENGINE = EXAMPLE)
drop table t1; drop table t1;
create table t1 (a int not null) create table t1 (a int not null)
engine=example ull=12340 engine=example ull=12340
...@@ -21,9 +21,9 @@ Table Create Table ...@@ -21,9 +21,9 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL `a` int(11) NOT NULL
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340 ) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340
PARTITION BY LIST (a) PARTITION BY LIST (`a`)
(PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE, (PARTITION `p0` VALUES IN (1) ENGINE = EXAMPLE,
PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) PARTITION `p1` VALUES IN (2) ENGINE = EXAMPLE)
drop table t1; drop table t1;
select 1; select 1;
1 1
......
This diff is collapsed.
...@@ -202,20 +202,20 @@ t1 CREATE TABLE `t1` ( ...@@ -202,20 +202,20 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`), PRIMARY KEY (`a`),
KEY `b` (`b`,`a`) KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (a) PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (a) SUBPARTITION BY HASH (`a`)
(PARTITION pNeg VALUES LESS THAN (0) (PARTITION `pNeg` VALUES LESS THAN (0)
(SUBPARTITION subp0 ENGINE = InnoDB, (SUBPARTITION `subp0` ENGINE = InnoDB,
SUBPARTITION subp1 ENGINE = InnoDB), SUBPARTITION `subp1` ENGINE = InnoDB),
PARTITION `p0-9` VALUES LESS THAN (10) PARTITION `p0-9` VALUES LESS THAN (10)
(SUBPARTITION subp2 ENGINE = InnoDB, (SUBPARTITION `subp2` ENGINE = InnoDB,
SUBPARTITION subp3 ENGINE = InnoDB), SUBPARTITION `subp3` ENGINE = InnoDB),
PARTITION `p10-99` VALUES LESS THAN (100) PARTITION `p10-99` VALUES LESS THAN (100)
(SUBPARTITION subp4 ENGINE = InnoDB, (SUBPARTITION `subp4` ENGINE = InnoDB,
SUBPARTITION subp5 ENGINE = InnoDB), SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p100-99999` VALUES LESS THAN (100000) PARTITION `p100-99999` VALUES LESS THAN (100000)
(SUBPARTITION subp6 ENGINE = InnoDB, (SUBPARTITION `subp6` ENGINE = InnoDB,
SUBPARTITION subp7 ENGINE = InnoDB)) SUBPARTITION `subp7` ENGINE = InnoDB))
# First test that the syntax is OK # First test that the syntax is OK
SHOW CREATE TABLE t1 PARTITION (subp0); SHOW CREATE TABLE t1 PARTITION (subp0);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PARTITION (subp0)' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PARTITION (subp0)' at line 1
...@@ -1125,20 +1125,20 @@ t1 CREATE TABLE `t1` ( ...@@ -1125,20 +1125,20 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`), PRIMARY KEY (`a`),
KEY `b` (`b`,`a`) KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (a) PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (a) SUBPARTITION BY HASH (`a`)
(PARTITION pNeg VALUES LESS THAN (0) (PARTITION `pNeg` VALUES LESS THAN (0)
(SUBPARTITION subp0 ENGINE = InnoDB, (SUBPARTITION `subp0` ENGINE = InnoDB,
SUBPARTITION subp1 ENGINE = InnoDB), SUBPARTITION `subp1` ENGINE = InnoDB),
PARTITION `p0-9` VALUES LESS THAN (10) PARTITION `p0-9` VALUES LESS THAN (10)
(SUBPARTITION subp2 ENGINE = InnoDB, (SUBPARTITION `subp2` ENGINE = InnoDB,
SUBPARTITION subp3 ENGINE = InnoDB), SUBPARTITION `subp3` ENGINE = InnoDB),
PARTITION `p10-99` VALUES LESS THAN (100) PARTITION `p10-99` VALUES LESS THAN (100)
(SUBPARTITION subp4 ENGINE = InnoDB, (SUBPARTITION `subp4` ENGINE = InnoDB,
SUBPARTITION subp5 ENGINE = InnoDB), SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p100-99999` VALUES LESS THAN (100000) PARTITION `p100-99999` VALUES LESS THAN (100000)
(SUBPARTITION subp6 ENGINE = InnoDB, (SUBPARTITION `subp6` ENGINE = InnoDB,
SUBPARTITION subp7 ENGINE = InnoDB)) SUBPARTITION `subp7` ENGINE = InnoDB))
SELECT * FROM t1; SELECT * FROM t1;
a b a b
-4 (pNeg-)subp0, Updated, Updated2, Updated from a = -2 -4 (pNeg-)subp0, Updated, Updated2, Updated from a = -2
...@@ -1157,20 +1157,20 @@ t2 CREATE TABLE `t2` ( ...@@ -1157,20 +1157,20 @@ t2 CREATE TABLE `t2` (
PRIMARY KEY (`a`), PRIMARY KEY (`a`),
KEY `b` (`b`,`a`) KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (a) PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (a) SUBPARTITION BY HASH (`a`)
(PARTITION pNeg VALUES LESS THAN (0) (PARTITION `pNeg` VALUES LESS THAN (0)
(SUBPARTITION subp0 ENGINE = InnoDB, (SUBPARTITION `subp0` ENGINE = InnoDB,
SUBPARTITION subp1 ENGINE = InnoDB), SUBPARTITION `subp1` ENGINE = InnoDB),
PARTITION `p0-9` VALUES LESS THAN (10) PARTITION `p0-9` VALUES LESS THAN (10)
(SUBPARTITION subp2 ENGINE = InnoDB, (SUBPARTITION `subp2` ENGINE = InnoDB,
SUBPARTITION subp3 ENGINE = InnoDB), SUBPARTITION `subp3` ENGINE = InnoDB),
PARTITION `p10-99` VALUES LESS THAN (100) PARTITION `p10-99` VALUES LESS THAN (100)
(SUBPARTITION subp4 ENGINE = InnoDB, (SUBPARTITION `subp4` ENGINE = InnoDB,
SUBPARTITION subp5 ENGINE = InnoDB), SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p100-99999` VALUES LESS THAN (100000) PARTITION `p100-99999` VALUES LESS THAN (100000)
(SUBPARTITION subp6 ENGINE = InnoDB, (SUBPARTITION `subp6` ENGINE = InnoDB,
SUBPARTITION subp7 ENGINE = InnoDB)) SUBPARTITION `subp7` ENGINE = InnoDB))
SELECT * FROM t2; SELECT * FROM t2;
a b a b
10 p10-99 10 p10-99
...@@ -1657,28 +1657,28 @@ t1 CREATE TABLE `t1` ( ...@@ -1657,28 +1657,28 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`), PRIMARY KEY (`a`),
KEY `b` (`b`,`a`) KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (a) PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (a) SUBPARTITION BY HASH (`a`)
(PARTITION pNeg VALUES LESS THAN (0) (PARTITION `pNeg` VALUES LESS THAN (0)
(SUBPARTITION subp0 ENGINE = InnoDB, (SUBPARTITION `subp0` ENGINE = InnoDB,
SUBPARTITION subp1 ENGINE = InnoDB, SUBPARTITION `subp1` ENGINE = InnoDB,
SUBPARTITION subp2 ENGINE = InnoDB), SUBPARTITION `subp2` ENGINE = InnoDB),
PARTITION `p0-29` VALUES LESS THAN (30) PARTITION `p0-29` VALUES LESS THAN (30)
(SUBPARTITION subp3 ENGINE = InnoDB, (SUBPARTITION `subp3` ENGINE = InnoDB,
SUBPARTITION subp4 ENGINE = InnoDB, SUBPARTITION `subp4` ENGINE = InnoDB,
SUBPARTITION subp5 ENGINE = InnoDB), SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p30-299` VALUES LESS THAN (300) PARTITION `p30-299` VALUES LESS THAN (300)
(SUBPARTITION subp6 ENGINE = InnoDB, (SUBPARTITION `subp6` ENGINE = InnoDB,
SUBPARTITION subp7 ENGINE = InnoDB, SUBPARTITION `subp7` ENGINE = InnoDB,
SUBPARTITION subp8 ENGINE = InnoDB), SUBPARTITION `subp8` ENGINE = InnoDB),
PARTITION `p300-2999` VALUES LESS THAN (3000) PARTITION `p300-2999` VALUES LESS THAN (3000)
(SUBPARTITION subp9 ENGINE = InnoDB, (SUBPARTITION `subp9` ENGINE = InnoDB,
SUBPARTITION subp10 ENGINE = InnoDB, SUBPARTITION `subp10` ENGINE = InnoDB,
SUBPARTITION subp11 ENGINE = InnoDB), SUBPARTITION `subp11` ENGINE = InnoDB),
PARTITION `p3000-299999` VALUES LESS THAN (300000) PARTITION `p3000-299999` VALUES LESS THAN (300000)
(SUBPARTITION subp12 ENGINE = InnoDB, (SUBPARTITION `subp12` ENGINE = InnoDB,
SUBPARTITION subp13 ENGINE = InnoDB, SUBPARTITION `subp13` ENGINE = InnoDB,
SUBPARTITION subp14 ENGINE = InnoDB)) SUBPARTITION `subp14` ENGINE = InnoDB))
INSERT INTO t1 VALUES (-9, "negative nine"), (-8, "-8"), (-7, "-7"), (-6, "-6"), (-5, "-5"), (-4, "-4"), (-3, "-3"), (-2, "-2"), (-1, "-1"); INSERT INTO t1 VALUES (-9, "negative nine"), (-8, "-8"), (-7, "-7"), (-6, "-6"), (-5, "-5"), (-4, "-4"), (-3, "-3"), (-2, "-2"), (-1, "-1");
INSERT INTO t1 VALUES (9, "nine"), (8, "8"), (7, "7"), (6, "6"), (5, "5"), (4, "4"), (3, "3"), (2, "2"), (1, "1"); INSERT INTO t1 VALUES (9, "nine"), (8, "8"), (7, "7"), (6, "6"), (5, "5"), (4, "4"), (3, "3"), (2, "2"), (1, "1");
INSERT INTO t1 VALUES (39, "Thirty nine"), (38, "38"), (37, "37"), (36, "36"), (35, "35"), (34, "34"), (33, "33"), (32, "32"), (31, "31"); INSERT INTO t1 VALUES (39, "Thirty nine"), (38, "38"), (37, "37"), (36, "36"), (35, "35"), (34, "34"), (33, "33"), (32, "32"), (31, "31");
......
...@@ -447,7 +447,7 @@ Table Create Table ...@@ -447,7 +447,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY KEY (a) PARTITION BY KEY (`a`)
drop table t1; drop table t1;
create table t1 (a int) create table t1 (a int)
engine = innodb engine = innodb
...@@ -461,8 +461,8 @@ Table Create Table ...@@ -461,8 +461,8 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY LIST (a) PARTITION BY LIST (`a`)
(PARTITION p0 VALUES IN (0) ENGINE = InnoDB) (PARTITION `p0` VALUES IN (0) ENGINE = InnoDB)
drop table t1; drop table t1;
SET SQL_MODE=default; SET SQL_MODE=default;
create table t1 create table t1
...@@ -540,10 +540,10 @@ t1 CREATE TABLE `t1` ( ...@@ -540,10 +540,10 @@ t1 CREATE TABLE `t1` (
`int_column` int(11) DEFAULT NULL, `int_column` int(11) DEFAULT NULL,
`char_column` char(5) DEFAULT NULL `char_column` char(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (int_column) PARTITION BY RANGE (`int_column`)
SUBPARTITION BY KEY (char_column) SUBPARTITION BY KEY (`char_column`)
SUBPARTITIONS 2 SUBPARTITIONS 2
(PARTITION p1 VALUES LESS THAN (5) ENGINE = MyISAM) (PARTITION `p1` VALUES LESS THAN (5) ENGINE = MyISAM)
drop table t1; drop table t1;
CREATE TABLE t1 (a INT) ENGINE=InnoDB CREATE TABLE t1 (a INT) ENGINE=InnoDB
PARTITION BY list(a) (PARTITION p1 VALUES IN (1)); PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
...@@ -588,7 +588,7 @@ t1 CREATE TABLE `t1` ( ...@@ -588,7 +588,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL, `b` int(11) NOT NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY KEY (a) PARTITION BY KEY (`a`)
PARTITIONS 2 PARTITIONS 2
SELECT * FROM t1; SELECT * FROM t1;
a b a b
......
...@@ -30,9 +30,9 @@ t1 CREATE TABLE `t1` ( ...@@ -30,9 +30,9 @@ t1 CREATE TABLE `t1` (
`id2` bigint(20) NOT NULL, `id2` bigint(20) NOT NULL,
PRIMARY KEY (`id`,`time`) PRIMARY KEY (`id`,`time`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8
PARTITION BY RANGE (TO_DAYS(time)) PARTITION BY RANGE (to_days(`time`))
(PARTITION p10 VALUES LESS THAN (734708) ENGINE = InnoDB, (PARTITION `p10` VALUES LESS THAN (734708) ENGINE = InnoDB,
PARTITION p20 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) PARTITION `p20` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
DROP TABLE t1; DROP TABLE t1;
call mtr.add_suppression("InnoDB: Error: table `test`.`t1` .* InnoDB internal"); call mtr.add_suppression("InnoDB: Error: table `test`.`t1` .* InnoDB internal");
# #
...@@ -59,7 +59,7 @@ t1 CREATE TABLE `t1` ( ...@@ -59,7 +59,7 @@ t1 CREATE TABLE `t1` (
`user_num` char(10) DEFAULT NULL, `user_num` char(10) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4
PARTITION BY HASH (id) PARTITION BY HASH (`id`)
PARTITIONS 1 PARTITIONS 1
SET GLOBAL innodb_file_per_table = OFF; SET GLOBAL innodb_file_per_table = OFF;
disconnect con1; disconnect con1;
...@@ -97,7 +97,7 @@ t1 CREATE TABLE `t1` ( ...@@ -97,7 +97,7 @@ t1 CREATE TABLE `t1` (
`user_num` char(10) DEFAULT NULL, `user_num` char(10) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4
PARTITION BY HASH (id) PARTITION BY HASH (`id`)
PARTITIONS 3 PARTITIONS 3
DROP TABLE t1; DROP TABLE t1;
disconnect con2; disconnect con2;
......
...@@ -57,14 +57,14 @@ partition p3 values in (3)); ...@@ -57,14 +57,14 @@ partition p3 values in (3));
select partition_method, partition_expression, partition_description select partition_method, partition_expression, partition_description
from information_schema.partitions where table_name = "t1"; from information_schema.partitions where table_name = "t1";
partition_method partition_expression partition_description partition_method partition_expression partition_description
LIST a 0 LIST `a` 0
LIST a 0 LIST `a` 0
LIST a 1 LIST `a` 1
LIST a 1 LIST `a` 1
LIST a NULL,2 LIST `a` NULL,2
LIST a NULL,2 LIST `a` NULL,2
LIST a 3 LIST `a` 3
LIST a 3 LIST `a` 3
insert into t1 values (0,0),(0,1),(1,0),(1,1),(null,0),(null,1); insert into t1 values (0,0),(0,1),(1,0),(1,1),(null,0),(null,1);
insert into t1 values (2,0),(2,1),(3,0),(3,1); insert into t1 values (2,0),(2,1),(3,0),(3,1);
explain partitions select * from t1 where a is null; explain partitions select * from t1 where a is null;
......
...@@ -24,7 +24,7 @@ t1 CREATE TABLE `t1` ( ...@@ -24,7 +24,7 @@ t1 CREATE TABLE `t1` (
`f_date` date DEFAULT NULL, `f_date` date DEFAULT NULL,
`f_varchar` varchar(30) DEFAULT NULL `f_varchar` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (YEAR(f_date)) PARTITION BY HASH (year(`f_date`))
PARTITIONS 2 PARTITIONS 2
ALTER TABLE t1 COALESCE PARTITION 1; ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -33,7 +33,7 @@ t1 CREATE TABLE `t1` ( ...@@ -33,7 +33,7 @@ t1 CREATE TABLE `t1` (
`f_date` date DEFAULT NULL, `f_date` date DEFAULT NULL,
`f_varchar` varchar(30) DEFAULT NULL `f_varchar` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (YEAR(f_date)) PARTITION BY HASH (year(`f_date`))
PARTITIONS 1 PARTITIONS 1
drop table t1; drop table t1;
create table t1 (a int) create table t1 (a int)
...@@ -58,7 +58,7 @@ Table Create Table ...@@ -58,7 +58,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (a) PARTITION BY HASH (`a`)
PARTITIONS 5 PARTITIONS 5
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT) CREATE TABLE t1 (a INT)
...@@ -70,7 +70,7 @@ Table Create Table ...@@ -70,7 +70,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (a) PARTITION BY HASH (`a`)
PARTITIONS 5 PARTITIONS 5
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT) CREATE TABLE t1 (a INT)
...@@ -81,7 +81,7 @@ Table Create Table ...@@ -81,7 +81,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (a) PARTITION BY HASH (`a`)
PARTITIONS 5 PARTITIONS 5
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT) /*!50100 PARTITION BY HASH (a) PARTITIONS 5 */; CREATE TABLE t1 (a INT) /*!50100 PARTITION BY HASH (a) PARTITIONS 5 */;
...@@ -90,6 +90,6 @@ Table Create Table ...@@ -90,6 +90,6 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (a) PARTITION BY HASH (`a`)
PARTITIONS 5 PARTITIONS 5
DROP TABLE t1; DROP TABLE t1;
...@@ -145,7 +145,7 @@ Table Create Table ...@@ -145,7 +145,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY KEY (a) PARTITION BY KEY (`a`)
PARTITIONS 2 PARTITIONS 2
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT) PARTITION BY HASH(a); CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
......
...@@ -27,10 +27,10 @@ Table Create Table ...@@ -27,10 +27,10 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 CHECKSUM=1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CHECKSUM=1
PARTITION BY RANGE (i) PARTITION BY RANGE (`i`)
(PARTITION p3 VALUES LESS THAN (3) ENGINE = MyISAM, (PARTITION `p3` VALUES LESS THAN (3) ENGINE = MyISAM,
PARTITION p5 VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION `p5` VALUES LESS THAN (5) ENGINE = MyISAM,
PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) PARTITION `pMax` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
DROP TABLE t1; DROP TABLE t1;
# Same test without partitioning # Same test without partitioning
CREATE TABLE t1 ( CREATE TABLE t1 (
...@@ -131,7 +131,7 @@ t1 CREATE TABLE `t1` ( ...@@ -131,7 +131,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL AUTO_INCREMENT, `a` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1 ) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
PARTITION BY KEY (a) PARTITION BY KEY (`a`)
INSERT INTO t1 VALUES (NULL); INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1; SELECT * FROM t1;
a a
......
...@@ -31,8 +31,8 @@ Table Create Table ...@@ -31,8 +31,8 @@ Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`i` int(11) DEFAULT NULL `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (i) PARTITION BY RANGE (`i`)
(PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) (PARTITION `p01` VALUES LESS THAN (1000) ENGINE = MyISAM)
DROP TABLE t1, t2; DROP TABLE t1, t2;
set @@sql_mode=@org_mode; set @@sql_mode=@org_mode;
CREATE TABLE t1(a INT) CREATE TABLE t1(a INT)
......
...@@ -22,9 +22,9 @@ Table Create Table ...@@ -22,9 +22,9 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` datetime DEFAULT NULL `a` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (TO_DAYS(a)) PARTITION BY RANGE (to_days(`a`))
SUBPARTITION BY HASH (to_seconds(a)) SUBPARTITION BY HASH (to_seconds(`a`))
(PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM) (PARTITION `p0` VALUES LESS THAN (1) ENGINE = MyISAM)
drop table t1; drop table t1;
create table t1 (a int) create table t1 (a int)
partition by range (a) partition by range (a)
...@@ -38,8 +38,8 @@ partition p1 VALUES LESS THAN (TO_SECONDS('2007-04-01 00:00:00'))); ...@@ -38,8 +38,8 @@ partition p1 VALUES LESS THAN (TO_SECONDS('2007-04-01 00:00:00')));
select partition_method, partition_expression, partition_description select partition_method, partition_expression, partition_description
from information_schema.partitions where table_name = "t1"; from information_schema.partitions where table_name = "t1";
partition_method partition_expression partition_description partition_method partition_expression partition_description
RANGE TO_SECONDS(a) 63340531200 RANGE to_seconds(`a`) 63340531200
RANGE TO_SECONDS(a) 63342604800 RANGE to_seconds(`a`) 63342604800
INSERT INTO t1 VALUES ('2007-03-01 12:00:00'), ('2007-03-07 12:00:00'); INSERT INTO t1 VALUES ('2007-03-01 12:00:00'), ('2007-03-07 12:00:00');
INSERT INTO t1 VALUES ('2007-03-08 12:00:00'), ('2007-03-15 12:00:00'); INSERT INTO t1 VALUES ('2007-03-08 12:00:00'), ('2007-03-15 12:00:00');
explain partitions select * from t1 where a < '2007-03-08 00:00:00'; explain partitions select * from t1 where a < '2007-03-08 00:00:00';
...@@ -62,9 +62,9 @@ Table Create Table ...@@ -62,9 +62,9 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` datetime NOT NULL `a` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (TO_SECONDS(a)) PARTITION BY RANGE (to_seconds(`a`))
(PARTITION p0 VALUES LESS THAN (63340531200) ENGINE = MyISAM, (PARTITION `p0` VALUES LESS THAN (63340531200) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (63342604800) ENGINE = MyISAM) PARTITION `p1` VALUES LESS THAN (63342604800) ENGINE = MyISAM)
drop table t1; drop table t1;
create table t1 (a date) create table t1 (a date)
partition by range(to_seconds(a)) partition by range(to_seconds(a))
...@@ -93,9 +93,9 @@ Table Create Table ...@@ -93,9 +93,9 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL `a` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (to_seconds(a)) PARTITION BY RANGE (to_seconds(`a`))
(PARTITION p0 VALUES LESS THAN (63240134400) ENGINE = MyISAM, (PARTITION `p0` VALUES LESS THAN (63240134400) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (63271756800) ENGINE = MyISAM) PARTITION `p1` VALUES LESS THAN (63271756800) ENGINE = MyISAM)
drop table t1; drop table t1;
create table t1 (a datetime) create table t1 (a datetime)
partition by range(to_seconds(a)) partition by range(to_seconds(a))
...@@ -123,9 +123,9 @@ Table Create Table ...@@ -123,9 +123,9 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` datetime DEFAULT NULL `a` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (to_seconds(a)) PARTITION BY RANGE (to_seconds(`a`))
(PARTITION p0 VALUES LESS THAN (63240177600) ENGINE = MyISAM, (PARTITION `p0` VALUES LESS THAN (63240177600) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (63271800000) ENGINE = MyISAM) PARTITION `p1` VALUES LESS THAN (63271800000) ENGINE = MyISAM)
drop table t1; drop table t1;
create table t1 (a int, b char(20)) create table t1 (a int, b char(20))
partition by range columns(a,b) partition by range columns(a,b)
...@@ -153,8 +153,8 @@ Table Create Table ...@@ -153,8 +153,8 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a) PARTITION BY RANGE (`a`)
(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) (PARTITION `p0` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
drop table t1; drop table t1;
create table t1 (a integer) create table t1 (a integer)
partition by range (a) partition by range (a)
...@@ -284,10 +284,10 @@ t1 CREATE TABLE `t1` ( ...@@ -284,10 +284,10 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL, `c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`) PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a) PARTITION BY RANGE (`a`)
(PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM, (PARTITION `x1` VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM,
PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM, PARTITION `x2` VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM,
PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM) PARTITION `x3` VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM)
ALTER TABLE t1 ALTER TABLE t1
partition by range (a) partition by range (a)
partitions 3 partitions 3
...@@ -308,10 +308,10 @@ t1 CREATE TABLE `t1` ( ...@@ -308,10 +308,10 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL, `c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`) PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a) PARTITION BY RANGE (`a`)
(PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM, (PARTITION `x1` VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM,
PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM, PARTITION `x2` VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM,
PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM) PARTITION `x3` VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM)
drop table if exists t1; drop table if exists t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
...@@ -409,14 +409,14 @@ t1 CREATE TABLE `t1` ( ...@@ -409,14 +409,14 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL, `c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`) PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a) PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (a+b) SUBPARTITION BY HASH (`a` + `b`)
(PARTITION x1 VALUES LESS THAN (1) (PARTITION `x1` VALUES LESS THAN (1)
(SUBPARTITION x11 ENGINE = MyISAM, (SUBPARTITION `x11` ENGINE = MyISAM,
SUBPARTITION x12 ENGINE = MyISAM), SUBPARTITION `x12` ENGINE = MyISAM),
PARTITION x2 VALUES LESS THAN (5) PARTITION `x2` VALUES LESS THAN (5)
(SUBPARTITION x21 ENGINE = MyISAM, (SUBPARTITION `x21` ENGINE = MyISAM,
SUBPARTITION x22 ENGINE = MyISAM)) SUBPARTITION `x22` ENGINE = MyISAM))
ALTER TABLE t1 ADD COLUMN d int; ALTER TABLE t1 ADD COLUMN d int;
show create table t1; show create table t1;
Table Create Table Table Create Table
...@@ -427,14 +427,14 @@ t1 CREATE TABLE `t1` ( ...@@ -427,14 +427,14 @@ t1 CREATE TABLE `t1` (
`d` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL,
PRIMARY KEY (`a`,`b`) PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a) PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (a+b) SUBPARTITION BY HASH (`a` + `b`)
(PARTITION x1 VALUES LESS THAN (1) (PARTITION `x1` VALUES LESS THAN (1)
(SUBPARTITION x11 ENGINE = MyISAM, (SUBPARTITION `x11` ENGINE = MyISAM,
SUBPARTITION x12 ENGINE = MyISAM), SUBPARTITION `x12` ENGINE = MyISAM),
PARTITION x2 VALUES LESS THAN (5) PARTITION `x2` VALUES LESS THAN (5)
(SUBPARTITION x21 ENGINE = MyISAM, (SUBPARTITION `x21` ENGINE = MyISAM,
SUBPARTITION x22 ENGINE = MyISAM)) SUBPARTITION `x22` ENGINE = MyISAM))
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
...@@ -658,9 +658,9 @@ Table Create Table ...@@ -658,9 +658,9 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned DEFAULT NULL `a` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a) PARTITION BY RANGE (`a`)
(PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM, (PARTITION `p0` VALUES LESS THAN (0) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM) PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM)
drop table t1; drop table t1;
create table t1 (a bigint unsigned) create table t1 (a bigint unsigned)
partition by range (a) partition by range (a)
...@@ -671,9 +671,9 @@ Table Create Table ...@@ -671,9 +671,9 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned DEFAULT NULL `a` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a) PARTITION BY RANGE (`a`)
(PARTITION p0 VALUES LESS THAN (2) ENGINE = MyISAM, (PARTITION `p0` VALUES LESS THAN (2) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM) PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM)
insert into t1 values (0xFFFFFFFFFFFFFFFF); insert into t1 values (0xFFFFFFFFFFFFFFFF);
ERROR HY000: Table has no partition for value 18446744073709551615 ERROR HY000: Table has no partition for value 18446744073709551615
drop table t1; drop table t1;
......
...@@ -22,10 +22,10 @@ Table Create Table ...@@ -22,10 +22,10 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST (a) PARTITION BY LIST (`a`)
(PARTITION p0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM, (PARTITION `p0` VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM,
PARTITION p1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM, PARTITION `p1` VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp' ENGINE = MyISAM,
PARTITION p2 VALUES IN (2) ENGINE = MyISAM) PARTITION `p2` VALUES IN (2) ENGINE = MyISAM)
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
...@@ -158,8 +158,8 @@ Table Create Table ...@@ -158,8 +158,8 @@ Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`i` int(11) DEFAULT NULL `i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (i) PARTITION BY RANGE (`i`)
(PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) (PARTITION `p01` VALUES LESS THAN (1000) ENGINE = MyISAM)
DROP TABLE t1, t2; DROP TABLE t1, t2;
set @@sql_mode=@org_mode; set @@sql_mode=@org_mode;
create table t1 (a int) create table t1 (a int)
......
...@@ -7,8 +7,8 @@ Table Create Table ...@@ -7,8 +7,8 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL `a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a) PARTITION BY LIST COLUMNS(`a`)
(PARTITION p0 VALUES IN (_cp1250 0x81) ENGINE = MyISAM) (PARTITION `p0` VALUES IN (_cp1250 0x81) ENGINE = MyISAM)
drop table t1; drop table t1;
create table t1 (a varchar(2) character set cp1250) create table t1 (a varchar(2) character set cp1250)
partition by list columns (a) partition by list columns (a)
...@@ -18,8 +18,8 @@ Table Create Table ...@@ -18,8 +18,8 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL `a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a) PARTITION BY LIST COLUMNS(`a`)
(PARTITION p0 VALUES IN ('€') ENGINE = MyISAM) (PARTITION `p0` VALUES IN ('€') ENGINE = MyISAM)
drop table t1; drop table t1;
create table t1 (a varchar(1500), b varchar(1570)) create table t1 (a varchar(1500), b varchar(1570))
partition by list columns(a,b) partition by list columns(a,b)
...@@ -45,9 +45,9 @@ Table Create Table ...@@ -45,9 +45,9 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET ucs2 DEFAULT NULL `a` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a) PARTITION BY LIST COLUMNS(`a`)
(PARTITION p0 VALUES IN ('†') ENGINE = MyISAM, (PARTITION `p0` VALUES IN ('†') ENGINE = MyISAM,
PARTITION p1 VALUES IN ('') ENGINE = MyISAM) PARTITION `p1` VALUES IN ('') ENGINE = MyISAM)
insert into t1 values (''); insert into t1 values ('');
insert into t1 values (_ucs2 0x2020); insert into t1 values (_ucs2 0x2020);
drop table t1; drop table t1;
...@@ -322,12 +322,12 @@ INSERT INTO t2 VALUES ...@@ -322,12 +322,12 @@ INSERT INTO t2 VALUES
('2006-10-02 21:50:01.5678',9); ('2006-10-02 21:50:01.5678',9);
select table_name,partition_name,partition_method,partition_expression,partition_description,table_rows from information_schema.partitions where table_name in ('t1', 't2'); select table_name,partition_name,partition_method,partition_expression,partition_description,table_rows from information_schema.partitions where table_name in ('t1', 't2');
table_name partition_name partition_method partition_expression partition_description table_rows table_name partition_name partition_method partition_expression partition_description table_rows
t1 p01 RANGE to_days(taken) 732920 0 t1 p01 RANGE to_days(`taken`) 732920 0
t1 p02 RANGE to_days(taken) 732950 7 t1 p02 RANGE to_days(`taken`) 732950 7
t1 p03 RANGE to_days(taken) MAXVALUE 3 t1 p03 RANGE to_days(`taken`) MAXVALUE 3
t2 p01 RANGE extract(microsecond from taken) 123000 3 t2 p01 RANGE extract(microsecond from `taken`) 123000 3
t2 p02 RANGE extract(microsecond from taken) 500000 4 t2 p02 RANGE extract(microsecond from `taken`) 500000 4
t2 p03 RANGE extract(microsecond from taken) MAXVALUE 3 t2 p03 RANGE extract(microsecond from `taken`) MAXVALUE 3
drop table t1, t2; drop table t1, t2;
create table t1 (a datetime, b datetime(6)); create table t1 (a datetime, b datetime(6));
insert t1 values ('2010-01-02 03:04:05.678912', '2010-01-02 03:04:05.678912'); insert t1 values ('2010-01-02 03:04:05.678912', '2010-01-02 03:04:05.678912');
......
...@@ -84,7 +84,7 @@ Table Create Table ...@@ -84,7 +84,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
PARTITION BY HASH (a) PARTITION BY HASH (`a`)
drop table t1; drop table t1;
CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT, CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT,
f1 VARCHAR(25), f1 VARCHAR(25),
...@@ -109,20 +109,20 @@ t1 CREATE TABLE `t1` ( ...@@ -109,20 +109,20 @@ t1 CREATE TABLE `t1` (
`f1` varchar(25) DEFAULT NULL, `f1` varchar(25) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=ARCHIVE AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 ) ENGINE=ARCHIVE AUTO_INCREMENT=101 DEFAULT CHARSET=latin1
PARTITION BY RANGE (id) PARTITION BY RANGE (`id`)
SUBPARTITION BY HASH (id) SUBPARTITION BY HASH (`id`)
SUBPARTITIONS 2 SUBPARTITIONS 2
(PARTITION pa1 VALUES LESS THAN (10) ENGINE = ARCHIVE, (PARTITION `pa1` VALUES LESS THAN (10) ENGINE = ARCHIVE,
PARTITION pa2 VALUES LESS THAN (20) ENGINE = ARCHIVE, PARTITION `pa2` VALUES LESS THAN (20) ENGINE = ARCHIVE,
PARTITION pa3 VALUES LESS THAN (30) ENGINE = ARCHIVE, PARTITION `pa3` VALUES LESS THAN (30) ENGINE = ARCHIVE,
PARTITION pa4 VALUES LESS THAN (40) ENGINE = ARCHIVE, PARTITION `pa4` VALUES LESS THAN (40) ENGINE = ARCHIVE,
PARTITION pa5 VALUES LESS THAN (50) ENGINE = ARCHIVE, PARTITION `pa5` VALUES LESS THAN (50) ENGINE = ARCHIVE,
PARTITION pa6 VALUES LESS THAN (60) ENGINE = ARCHIVE, PARTITION `pa6` VALUES LESS THAN (60) ENGINE = ARCHIVE,
PARTITION pa7 VALUES LESS THAN (70) ENGINE = ARCHIVE, PARTITION `pa7` VALUES LESS THAN (70) ENGINE = ARCHIVE,
PARTITION pa8 VALUES LESS THAN (80) ENGINE = ARCHIVE, PARTITION `pa8` VALUES LESS THAN (80) ENGINE = ARCHIVE,
PARTITION pa9 VALUES LESS THAN (90) ENGINE = ARCHIVE, PARTITION `pa9` VALUES LESS THAN (90) ENGINE = ARCHIVE,
PARTITION pa10 VALUES LESS THAN (100) ENGINE = ARCHIVE, PARTITION `pa10` VALUES LESS THAN (100) ENGINE = ARCHIVE,
PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE) PARTITION `pa11` VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE)
select count(*) from t1; select count(*) from t1;
count(*) count(*)
100 100
...@@ -138,7 +138,7 @@ t1 CREATE TABLE `t1` ( ...@@ -138,7 +138,7 @@ t1 CREATE TABLE `t1` (
`fld1` int(11) NOT NULL, `fld1` int(11) NOT NULL,
PRIMARY KEY (`fld1`) PRIMARY KEY (`fld1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (fld1) PARTITION BY HASH (`fld1`)
PARTITIONS 5 PARTITIONS 5
ALTER TABLE t1 ENGINE= ARCHIVE; ALTER TABLE t1 ENGINE= ARCHIVE;
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
...@@ -149,7 +149,7 @@ t1 CREATE TABLE `t1` ( ...@@ -149,7 +149,7 @@ t1 CREATE TABLE `t1` (
`fld1` int(11) NOT NULL, `fld1` int(11) NOT NULL,
PRIMARY KEY (`fld1`) PRIMARY KEY (`fld1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (fld1) PARTITION BY HASH (`fld1`)
PARTITIONS 5 PARTITIONS 5
#Cleanup. #Cleanup.
DROP TABLE t1; DROP TABLE t1;
......
...@@ -31,7 +31,7 @@ Table Create Table ...@@ -31,7 +31,7 @@ Table Create Table
t4 CREATE TABLE `t4` ( t4 CREATE TABLE `t4` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes ) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes
PARTITION BY HASH (a) PARTITION BY HASH (`a`)
PARTITIONS 2 PARTITIONS 2
alter table t1 encrypted=no; alter table t1 encrypted=no;
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
......
...@@ -21,9 +21,9 @@ t1 CREATE TABLE `t1` ( ...@@ -21,9 +21,9 @@ t1 CREATE TABLE `t1` (
`s1` int(11) NOT NULL, `s1` int(11) NOT NULL,
PRIMARY KEY (`s1`) PRIMARY KEY (`s1`)
) ENGINE=FEDERATED DEFAULT CHARSET=latin1 ) ENGINE=FEDERATED DEFAULT CHARSET=latin1
PARTITION BY LIST (s1) PARTITION BY LIST (`s1`)
(PARTITION p1 VALUES IN (1,3) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1' ENGINE = FEDERATED, (PARTITION `p1` VALUES IN (1,3) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1' ENGINE = FEDERATED,
PARTITION p2 VALUES IN (2,4) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_2' ENGINE = FEDERATED) PARTITION `p2` VALUES IN (2,4) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_2' ENGINE = FEDERATED)
insert into t1 values (1), (2), (3), (4); insert into t1 values (1), (2), (3), (4);
select * from t1; select * from t1;
s1 s1
......
...@@ -1002,7 +1002,7 @@ t CREATE TABLE `t` ( ...@@ -1002,7 +1002,7 @@ t CREATE TABLE `t` (
KEY `col_date_key` (`col_date_key`,`col_time_key`,`col_datetime_key`), KEY `col_date_key` (`col_date_key`,`col_time_key`,`col_datetime_key`),
KEY `col_varchar_key` (`col_varchar_key`,`col_varchar_nokey`) KEY `col_varchar_key` (`col_varchar_key`,`col_varchar_nokey`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY KEY (col_int_key) PARTITION BY KEY (`col_int_key`)
PARTITIONS 3 PARTITIONS 3
DROP TABLE t; DROP TABLE t;
CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); CREATE TABLE t (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10));
......
...@@ -10,11 +10,11 @@ t1 CREATE TABLE `t1` ( ...@@ -10,11 +10,11 @@ t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned NOT NULL, `a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY KEY (a) PARTITION BY KEY (`a`)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, (PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION `pa3` MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) PARTITION `pa4` MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB)
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535); insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
select * from t1; select * from t1;
a a
...@@ -58,7 +58,7 @@ t2 CREATE TABLE `t2` ( ...@@ -58,7 +58,7 @@ t2 CREATE TABLE `t2` (
`a` bigint(20) unsigned NOT NULL, `a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY KEY (a) PARTITION BY KEY (`a`)
PARTITIONS 8 PARTITIONS 8
insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612); insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t2; select * from t2;
...@@ -90,7 +90,7 @@ t3 CREATE TABLE `t3` ( ...@@ -90,7 +90,7 @@ t3 CREATE TABLE `t3` (
`a` bigint(20) NOT NULL, `a` bigint(20) NOT NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY KEY (a) PARTITION BY KEY (`a`)
PARTITIONS 7 PARTITIONS 7
insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0); insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0);
select * from t3; select * from t3;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment