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
t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY KEY (c1)
PARTITION BY KEY (`c1`)
PARTITIONS 3
INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å');
INSERT INTO t1 VALUES ('B');
......
......@@ -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"
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
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 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 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 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))
partition by range (a)
partitions 3
......@@ -19,18 +19,18 @@ partition x3 values less than maxvalue tablespace ts3);
select * from information_schema.partitions where table_schema="test"
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
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 x3 NULL 3 NULL RANGE NULL a NULL MAXVALUE 0 0 0 # 1024 0 # # NULL NULL default ts3
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 x3 NULL 3 NULL RANGE NULL `a` NULL MAXVALUE 0 0 0 # 1024 0 # # NULL NULL default ts3
create table t3 (f1 date)
partition by hash(month(f1))
partitions 3;
select * from information_schema.partitions where table_schema="test"
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
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 p2 NULL 3 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 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)
partition by key(f1,f2)
partitions 3;
......@@ -63,14 +63,14 @@ subpartition x22 tablespace t2)
);
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
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 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 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 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 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 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 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 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
drop table t1,t2;
create table t1 (
a int not null,
......@@ -88,10 +88,10 @@ subpartition x22 tablespace t2 nodegroup 1)
);
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
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 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 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 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
show tables;
Tables_in_test
t1
......@@ -107,9 +107,9 @@ partitions 3;
select * from information_schema.partitions where table_schema="test"
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
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 p2 NULL 3 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 p2 NULL 3 NULL LINEAR HASH NULL month(`f1`) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default NULL
drop table t1;
create table t1 (a int)
PARTITION BY RANGE (a)
......@@ -120,9 +120,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a)
SUBPARTITION BY LINEAR HASH (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM)
PARTITION BY RANGE (`a`)
SUBPARTITION BY LINEAR HASH (`a`)
(PARTITION `p0` VALUES LESS THAN (10) ENGINE = MyISAM)
select SUBPARTITION_METHOD FROM information_schema.partitions WHERE
table_schema="test" AND table_name="t1";
SUBPARTITION_METHOD
......@@ -138,8 +138,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
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 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)
SELECT PARTITION_DESCRIPTION FROM information_schema.partitions WHERE
table_schema = "test" AND table_name = "t1";
PARTITION_DESCRIPTION
......
This diff is collapsed.
......@@ -70,9 +70,9 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`id`,`d`),
CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,10))
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(d)
(PARTITION p1 VALUES LESS THAN ('2016-10-18') ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN ('2020-10-19') ENGINE = InnoDB)
PARTITION BY RANGE COLUMNS(`d`)
(PARTITION `p1` VALUES LESS THAN ('2016-10-18') ENGINE = InnoDB,
PARTITION `p2` VALUES LESS THAN ('2020-10-19') ENGINE = InnoDB)
insert t1 values (2, '2020-01-03', 20);
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1;
......@@ -94,9 +94,9 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`id`,`d`),
CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,10))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(d)
(PARTITION p1 VALUES LESS THAN ('2016-10-18') ENGINE = MyISAM,
PARTITION p2 VALUES LESS THAN ('2020-10-19') ENGINE = MyISAM)
PARTITION BY RANGE COLUMNS(`d`)
(PARTITION `p1` VALUES LESS THAN ('2016-10-18') ENGINE = MyISAM,
PARTITION `p2` VALUES LESS THAN ('2020-10-19') ENGINE = MyISAM)
insert t1 values (2, '2020-01-03', 20);
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1;
......@@ -23,10 +23,10 @@ t1 CREATE TABLE `t1` (
`created_at` datetime NOT NULL,
`cool` tinyint(4) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (TO_DAYS(created_at))
(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = InnoDB,
PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = InnoDB,
PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
PARTITION BY RANGE (to_days(`created_at`))
(PARTITION `month_2010_4` VALUES LESS THAN (734258) ENGINE = InnoDB,
PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = InnoDB,
PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
show status like "Qcache_queries_in_cache";
......@@ -72,12 +72,12 @@ t1 CREATE TABLE `t1` (
`created_at` datetime NOT NULL,
`cool` tinyint(4) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (TO_DAYS(created_at))
SUBPARTITION BY HASH (cool)
PARTITION BY RANGE (to_days(`created_at`))
SUBPARTITION BY HASH (`cool`)
SUBPARTITIONS 3
(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = InnoDB,
PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = InnoDB,
PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
(PARTITION `month_2010_4` VALUES LESS THAN (734258) ENGINE = InnoDB,
PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = InnoDB,
PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
show status like "Qcache_queries_in_cache";
......
......@@ -23,10 +23,10 @@ t1 CREATE TABLE `t1` (
`created_at` datetime NOT NULL,
`cool` tinyint(4) DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (TO_DAYS(created_at))
(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = MyISAM,
PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = MyISAM,
PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
PARTITION BY RANGE (to_days(`created_at`))
(PARTITION `month_2010_4` VALUES LESS THAN (734258) ENGINE = MyISAM,
PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = MyISAM,
PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
show status like "Qcache_queries_in_cache";
......@@ -72,12 +72,12 @@ t1 CREATE TABLE `t1` (
`created_at` datetime NOT NULL,
`cool` tinyint(4) DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (TO_DAYS(created_at))
SUBPARTITION BY HASH (cool)
PARTITION BY RANGE (to_days(`created_at`))
SUBPARTITION BY HASH (`cool`)
SUBPARTITIONS 3
(PARTITION month_2010_4 VALUES LESS THAN (734258) ENGINE = MyISAM,
PARTITION month_2010_5 VALUES LESS THAN (734289) ENGINE = MyISAM,
PARTITION month_max VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
(PARTITION `month_2010_4` VALUES LESS THAN (734258) ENGINE = MyISAM,
PARTITION `month_2010_5` VALUES LESS THAN (734289) ENGINE = MyISAM,
PARTITION `month_max` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
INSERT INTO t1 VALUES (1, now(), 0);
flush status;
show status like "Qcache_queries_in_cache";
......
......@@ -30,9 +30,9 @@ t1 CREATE TABLE `t1` (
`department` varchar(10) DEFAULT NULL,
`country` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(department,country)
(PARTITION first_office VALUES IN (('dep1','Russia'),('dep1','Croatia')) ENGINE = MyISAM,
PARTITION second_office VALUES IN (('dep2','Russia')) ENGINE = MyISAM)
PARTITION BY LIST COLUMNS(`department`,`country`)
(PARTITION `first_office` VALUES IN (('dep1','Russia'),('dep1','Croatia')) ENGINE = MyISAM,
PARTITION `second_office` VALUES IN (('dep2','Russia')) ENGINE = MyISAM)
SELECT * FROM t1 WHERE department = 'dep2' and country = 'Croatia';
id name department country
SELECT * FROM t1 WHERE department = 'dep1' and country = 'Croatia';
......@@ -173,10 +173,10 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN ('''') ENGINE = MyISAM,
PARTITION p1 VALUES IN ('\\') ENGINE = MyISAM,
PARTITION p2 VALUES IN ('\0') ENGINE = MyISAM)
PARTITION BY LIST COLUMNS(`a`)
(PARTITION `p0` VALUES IN ('''') ENGINE = MyISAM,
PARTITION `p1` VALUES IN ('\\') ENGINE = MyISAM,
PARTITION `p2` VALUES IN ('\0') ENGINE = MyISAM)
drop table t1;
set @@sql_mode=allow_invalid_dates;
create table t1 (a char, b char, c date)
......@@ -232,13 +232,13 @@ t1 CREATE TABLE `t1` (
`c` varchar(25) DEFAULT NULL,
`d` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(a,b,c,d)
SUBPARTITION BY HASH (to_seconds(d))
PARTITION BY RANGE COLUMNS(`a`,`b`,`c`,`d`)
SUBPARTITION BY HASH (to_seconds(`d`))
SUBPARTITIONS 4
(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 p2 VALUES LESS THAN (1,'b',MAXVALUE,MAXVALUE) ENGINE = MyISAM,
PARTITION p3 VALUES LESS THAN (1,MAXVALUE,MAXVALUE,MAXVALUE) 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 `p2` VALUES LESS THAN (1,'b',MAXVALUE,MAXVALUE) ENGINE = MyISAM,
PARTITION `p3` VALUES LESS THAN (1,MAXVALUE,MAXVALUE,MAXVALUE) ENGINE = MyISAM)
drop table t1;
create table t1 (a int, b int)
partition by range columns (a,b)
......@@ -315,10 +315,10 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a,b)
(PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM,
PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM,
PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM)
PARTITION BY LIST COLUMNS(`a`,`b`)
(PARTITION `p0` VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM,
PARTITION `p1` VALUES IN ((1,1),(2,2)) ENGINE = MyISAM,
PARTITION `p2` VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM)
insert into t1 values (3, NULL);
insert into t1 values (NULL, 1);
insert into t1 values (NULL, NULL);
......@@ -349,10 +349,10 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a,b)
(PARTITION p0 VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM,
PARTITION p1 VALUES IN ((1,1),(2,2)) ENGINE = MyISAM,
PARTITION p2 VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM)
PARTITION BY LIST COLUMNS(`a`,`b`)
(PARTITION `p0` VALUES IN ((1,NULL),(2,NULL),(NULL,NULL)) ENGINE = MyISAM,
PARTITION `p1` VALUES IN ((1,1),(2,2)) ENGINE = MyISAM,
PARTITION `p2` VALUES IN ((3,NULL),(NULL,1)) ENGINE = MyISAM)
drop table t1;
create table t1 (a int)
partition by list (a)
......@@ -366,16 +366,16 @@ partition p1 values in (4, NULL, 3));
select partition_method, partition_expression, partition_description
from information_schema.partitions where table_name = "t1";
partition_method partition_expression partition_description
LIST a 2,1
LIST a NULL,4,3
LIST `a` 2,1
LIST `a` NULL,4,3
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM,
PARTITION p1 VALUES IN (NULL,4,3) ENGINE = MyISAM)
PARTITION BY LIST (`a`)
(PARTITION `p0` VALUES IN (2,1) ENGINE = MyISAM,
PARTITION `p1` VALUES IN (NULL,4,3) ENGINE = MyISAM)
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (3);
......@@ -403,9 +403,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM,
PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM)
PARTITION BY LIST COLUMNS(`a`)
(PARTITION `p0` VALUES IN (2,1) ENGINE = MyISAM,
PARTITION `p1` VALUES IN (4,NULL,3) ENGINE = MyISAM)
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (3);
......@@ -418,9 +418,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN (2,1) ENGINE = MyISAM,
PARTITION p1 VALUES IN (4,NULL,3) ENGINE = MyISAM)
PARTITION BY LIST COLUMNS(`a`)
(PARTITION `p0` VALUES IN (2,1) ENGINE = MyISAM,
PARTITION `p1` VALUES IN (4,NULL,3) ENGINE = MyISAM)
drop table t1;
create table t1 (a int, b char(10), c varchar(5), d int)
partition by range columns(a,b,c)
......@@ -453,13 +453,13 @@ t1 CREATE TABLE `t1` (
`c` varchar(5) DEFAULT NULL,
`d` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(a,b,c)
SUBPARTITION BY KEY (c,d)
PARTITION BY RANGE COLUMNS(`a`,`b`,`c`)
SUBPARTITION BY KEY (`c`,`d`)
SUBPARTITIONS 3
(PARTITION p0 VALUES LESS THAN (1,'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 p3 VALUES LESS THAN (4,'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 `p2` VALUES LESS THAN (3,'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,'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);
......@@ -486,9 +486,9 @@ t1 CREATE TABLE `t1` (
`b` varchar(2) DEFAULT NULL,
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(a,b,c)
(PARTITION p0 VALUES LESS THAN (1,'A',1) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (1,'B',1) ENGINE = MyISAM)
PARTITION BY RANGE COLUMNS(`a`,`b`,`c`)
(PARTITION `p0` VALUES LESS THAN (1,'A',1) ENGINE = MyISAM,
PARTITION `p1` VALUES LESS THAN (1,'B',1) ENGINE = MyISAM)
insert into t1 values (1, 'A', 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
......
......@@ -329,10 +329,10 @@ t1 CREATE TABLE `t1` (
`a` bit(27) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (a)
(PARTITION p0 ENGINE = MyISAM,
PARTITION p1 ENGINE = MyISAM,
PARTITION p2 ENGINE = MyISAM)
PARTITION BY HASH (`a`)
(PARTITION `p0` ENGINE = MyISAM,
PARTITION `p1` ENGINE = MyISAM,
PARTITION `p2` ENGINE = MyISAM)
insert into t1 values (1),(4),(7),(10),(13),(16),(19),(22),(25),(28),(31),(34);
select hex(a) from t1 where a = 7;
hex(a)
......@@ -850,16 +850,16 @@ t2 CREATE TABLE `t2` (
`a` timestamp NULL DEFAULT NULL,
`tz` varchar(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (UNIX_TIMESTAMP(a))
(PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM,
PARTITION BY RANGE (unix_timestamp(`a`))
(PARTITION `p0` VALUES LESS THAN (0) ENGINE = MyISAM,
PARTITION `p-2000` VALUES LESS THAN (946684800) 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-2` VALUES LESS THAN (1319929200) 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 pEnd VALUES LESS THAN (2147483647) ENGINE = MyISAM,
PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
PARTITION `pEnd` VALUES LESS THAN (2147483647) ENGINE = MyISAM,
PARTITION `pMax` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
TRUNCATE TABLE t2;
SET @@session.time_zone = 'Europe/Moscow';
INSERT INTO t2 SELECT * FROM t1;
......@@ -1334,16 +1334,16 @@ t2 CREATE TABLE `t2` (
`a` timestamp NULL DEFAULT NULL,
`tz` varchar(16) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (UNIX_TIMESTAMP(a))
(PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM,
PARTITION BY RANGE (unix_timestamp(`a`))
(PARTITION `p0` VALUES LESS THAN (0) ENGINE = MyISAM,
PARTITION `p-2000` VALUES LESS THAN (946684800) 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-2` VALUES LESS THAN (1319929200) 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 pEnd VALUES LESS THAN (2147483647) ENGINE = MyISAM,
PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
PARTITION `pEnd` VALUES LESS THAN (2147483647) ENGINE = MyISAM,
PARTITION `pMax` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
TRUNCATE TABLE t2;
DROP TABLE t1, t2;
SET @@session.time_zone= @old_time_zone;
This diff is collapsed.
This diff is collapsed.
......@@ -8,9 +8,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE,
PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE)
PARTITION BY LIST (`a`)
(PARTITION `p0` VALUES IN (1) ENGINE = EXAMPLE,
PARTITION `p1` VALUES IN (2) ENGINE = EXAMPLE)
drop table t1;
create table t1 (a int not null)
engine=example ull=12340
......@@ -21,9 +21,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE,
PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE)
PARTITION BY LIST (`a`)
(PARTITION `p0` VALUES IN (1) ENGINE = EXAMPLE,
PARTITION `p1` VALUES IN (2) ENGINE = EXAMPLE)
drop table t1;
select 1;
1
......
This diff is collapsed.
......@@ -202,20 +202,20 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`),
KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
(PARTITION pNeg VALUES LESS THAN (0)
(SUBPARTITION subp0 ENGINE = InnoDB,
SUBPARTITION subp1 ENGINE = InnoDB),
PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a`)
(PARTITION `pNeg` VALUES LESS THAN (0)
(SUBPARTITION `subp0` ENGINE = InnoDB,
SUBPARTITION `subp1` ENGINE = InnoDB),
PARTITION `p0-9` VALUES LESS THAN (10)
(SUBPARTITION subp2 ENGINE = InnoDB,
SUBPARTITION subp3 ENGINE = InnoDB),
(SUBPARTITION `subp2` ENGINE = InnoDB,
SUBPARTITION `subp3` ENGINE = InnoDB),
PARTITION `p10-99` VALUES LESS THAN (100)
(SUBPARTITION subp4 ENGINE = InnoDB,
SUBPARTITION subp5 ENGINE = InnoDB),
(SUBPARTITION `subp4` ENGINE = InnoDB,
SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p100-99999` VALUES LESS THAN (100000)
(SUBPARTITION subp6 ENGINE = InnoDB,
SUBPARTITION subp7 ENGINE = InnoDB))
(SUBPARTITION `subp6` ENGINE = InnoDB,
SUBPARTITION `subp7` ENGINE = InnoDB))
# First test that the syntax is OK
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
......@@ -1125,20 +1125,20 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`),
KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
(PARTITION pNeg VALUES LESS THAN (0)
(SUBPARTITION subp0 ENGINE = InnoDB,
SUBPARTITION subp1 ENGINE = InnoDB),
PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a`)
(PARTITION `pNeg` VALUES LESS THAN (0)
(SUBPARTITION `subp0` ENGINE = InnoDB,
SUBPARTITION `subp1` ENGINE = InnoDB),
PARTITION `p0-9` VALUES LESS THAN (10)
(SUBPARTITION subp2 ENGINE = InnoDB,
SUBPARTITION subp3 ENGINE = InnoDB),
(SUBPARTITION `subp2` ENGINE = InnoDB,
SUBPARTITION `subp3` ENGINE = InnoDB),
PARTITION `p10-99` VALUES LESS THAN (100)
(SUBPARTITION subp4 ENGINE = InnoDB,
SUBPARTITION subp5 ENGINE = InnoDB),
(SUBPARTITION `subp4` ENGINE = InnoDB,
SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p100-99999` VALUES LESS THAN (100000)
(SUBPARTITION subp6 ENGINE = InnoDB,
SUBPARTITION subp7 ENGINE = InnoDB))
(SUBPARTITION `subp6` ENGINE = InnoDB,
SUBPARTITION `subp7` ENGINE = InnoDB))
SELECT * FROM t1;
a b
-4 (pNeg-)subp0, Updated, Updated2, Updated from a = -2
......@@ -1157,20 +1157,20 @@ t2 CREATE TABLE `t2` (
PRIMARY KEY (`a`),
KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
(PARTITION pNeg VALUES LESS THAN (0)
(SUBPARTITION subp0 ENGINE = InnoDB,
SUBPARTITION subp1 ENGINE = InnoDB),
PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a`)
(PARTITION `pNeg` VALUES LESS THAN (0)
(SUBPARTITION `subp0` ENGINE = InnoDB,
SUBPARTITION `subp1` ENGINE = InnoDB),
PARTITION `p0-9` VALUES LESS THAN (10)
(SUBPARTITION subp2 ENGINE = InnoDB,
SUBPARTITION subp3 ENGINE = InnoDB),
(SUBPARTITION `subp2` ENGINE = InnoDB,
SUBPARTITION `subp3` ENGINE = InnoDB),
PARTITION `p10-99` VALUES LESS THAN (100)
(SUBPARTITION subp4 ENGINE = InnoDB,
SUBPARTITION subp5 ENGINE = InnoDB),
(SUBPARTITION `subp4` ENGINE = InnoDB,
SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p100-99999` VALUES LESS THAN (100000)
(SUBPARTITION subp6 ENGINE = InnoDB,
SUBPARTITION subp7 ENGINE = InnoDB))
(SUBPARTITION `subp6` ENGINE = InnoDB,
SUBPARTITION `subp7` ENGINE = InnoDB))
SELECT * FROM t2;
a b
10 p10-99
......@@ -1657,28 +1657,28 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`),
KEY `b` (`b`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a)
(PARTITION pNeg VALUES LESS THAN (0)
(SUBPARTITION subp0 ENGINE = InnoDB,
SUBPARTITION subp1 ENGINE = InnoDB,
SUBPARTITION subp2 ENGINE = InnoDB),
PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a`)
(PARTITION `pNeg` VALUES LESS THAN (0)
(SUBPARTITION `subp0` ENGINE = InnoDB,
SUBPARTITION `subp1` ENGINE = InnoDB,
SUBPARTITION `subp2` ENGINE = InnoDB),
PARTITION `p0-29` VALUES LESS THAN (30)
(SUBPARTITION subp3 ENGINE = InnoDB,
SUBPARTITION subp4 ENGINE = InnoDB,
SUBPARTITION subp5 ENGINE = InnoDB),
(SUBPARTITION `subp3` ENGINE = InnoDB,
SUBPARTITION `subp4` ENGINE = InnoDB,
SUBPARTITION `subp5` ENGINE = InnoDB),
PARTITION `p30-299` VALUES LESS THAN (300)
(SUBPARTITION subp6 ENGINE = InnoDB,
SUBPARTITION subp7 ENGINE = InnoDB,
SUBPARTITION subp8 ENGINE = InnoDB),
(SUBPARTITION `subp6` ENGINE = InnoDB,
SUBPARTITION `subp7` ENGINE = InnoDB,
SUBPARTITION `subp8` ENGINE = InnoDB),
PARTITION `p300-2999` VALUES LESS THAN (3000)
(SUBPARTITION subp9 ENGINE = InnoDB,
SUBPARTITION subp10 ENGINE = InnoDB,
SUBPARTITION subp11 ENGINE = InnoDB),
(SUBPARTITION `subp9` ENGINE = InnoDB,
SUBPARTITION `subp10` ENGINE = InnoDB,
SUBPARTITION `subp11` ENGINE = InnoDB),
PARTITION `p3000-299999` VALUES LESS THAN (300000)
(SUBPARTITION subp12 ENGINE = InnoDB,
SUBPARTITION subp13 ENGINE = InnoDB,
SUBPARTITION subp14 ENGINE = InnoDB))
(SUBPARTITION `subp12` ENGINE = InnoDB,
SUBPARTITION `subp13` 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, "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");
......
......@@ -447,7 +447,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY KEY (a)
PARTITION BY KEY (`a`)
drop table t1;
create table t1 (a int)
engine = innodb
......@@ -461,8 +461,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (0) ENGINE = InnoDB)
PARTITION BY LIST (`a`)
(PARTITION `p0` VALUES IN (0) ENGINE = InnoDB)
drop table t1;
SET SQL_MODE=default;
create table t1
......@@ -540,10 +540,10 @@ t1 CREATE TABLE `t1` (
`int_column` int(11) DEFAULT NULL,
`char_column` char(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (int_column)
SUBPARTITION BY KEY (char_column)
PARTITION BY RANGE (`int_column`)
SUBPARTITION BY KEY (`char_column`)
SUBPARTITIONS 2
(PARTITION p1 VALUES LESS THAN (5) ENGINE = MyISAM)
(PARTITION `p1` VALUES LESS THAN (5) ENGINE = MyISAM)
drop table t1;
CREATE TABLE t1 (a INT) ENGINE=InnoDB
PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
......@@ -588,7 +588,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY KEY (a)
PARTITION BY KEY (`a`)
PARTITIONS 2
SELECT * FROM t1;
a b
......
......@@ -30,9 +30,9 @@ t1 CREATE TABLE `t1` (
`id2` bigint(20) NOT NULL,
PRIMARY KEY (`id`,`time`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8
PARTITION BY RANGE (TO_DAYS(time))
(PARTITION p10 VALUES LESS THAN (734708) ENGINE = InnoDB,
PARTITION p20 VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
PARTITION BY RANGE (to_days(`time`))
(PARTITION `p10` VALUES LESS THAN (734708) ENGINE = InnoDB,
PARTITION `p20` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
DROP TABLE t1;
call mtr.add_suppression("InnoDB: Error: table `test`.`t1` .* InnoDB internal");
#
......@@ -59,7 +59,7 @@ t1 CREATE TABLE `t1` (
`user_num` char(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4
PARTITION BY HASH (id)
PARTITION BY HASH (`id`)
PARTITIONS 1
SET GLOBAL innodb_file_per_table = OFF;
disconnect con1;
......@@ -97,7 +97,7 @@ t1 CREATE TABLE `t1` (
`user_num` char(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4
PARTITION BY HASH (id)
PARTITION BY HASH (`id`)
PARTITIONS 3
DROP TABLE t1;
disconnect con2;
......
......@@ -57,14 +57,14 @@ partition p3 values in (3));
select partition_method, partition_expression, partition_description
from information_schema.partitions where table_name = "t1";
partition_method partition_expression partition_description
LIST a 0
LIST a 0
LIST a 1
LIST a 1
LIST a NULL,2
LIST a NULL,2
LIST a 3
LIST a 3
LIST `a` 0
LIST `a` 0
LIST `a` 1
LIST `a` 1
LIST `a` NULL,2
LIST `a` NULL,2
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 (2,0),(2,1),(3,0),(3,1);
explain partitions select * from t1 where a is null;
......
......@@ -24,7 +24,7 @@ t1 CREATE TABLE `t1` (
`f_date` date DEFAULT NULL,
`f_varchar` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (YEAR(f_date))
PARTITION BY HASH (year(`f_date`))
PARTITIONS 2
ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
......@@ -33,7 +33,7 @@ t1 CREATE TABLE `t1` (
`f_date` date DEFAULT NULL,
`f_varchar` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (YEAR(f_date))
PARTITION BY HASH (year(`f_date`))
PARTITIONS 1
drop table t1;
create table t1 (a int)
......@@ -58,7 +58,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (a)
PARTITION BY HASH (`a`)
PARTITIONS 5
DROP TABLE t1;
CREATE TABLE t1 (a INT)
......@@ -70,7 +70,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (a)
PARTITION BY HASH (`a`)
PARTITIONS 5
DROP TABLE t1;
CREATE TABLE t1 (a INT)
......@@ -81,7 +81,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (a)
PARTITION BY HASH (`a`)
PARTITIONS 5
DROP TABLE t1;
CREATE TABLE t1 (a INT) /*!50100 PARTITION BY HASH (a) PARTITIONS 5 */;
......@@ -90,6 +90,6 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (a)
PARTITION BY HASH (`a`)
PARTITIONS 5
DROP TABLE t1;
......@@ -145,7 +145,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY KEY (a)
PARTITION BY KEY (`a`)
PARTITIONS 2
DROP TABLE t1;
CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
......
......@@ -27,10 +27,10 @@ Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 CHECKSUM=1
PARTITION BY RANGE (i)
(PARTITION p3 VALUES LESS THAN (3) ENGINE = MyISAM,
PARTITION p5 VALUES LESS THAN (5) ENGINE = MyISAM,
PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
PARTITION BY RANGE (`i`)
(PARTITION `p3` VALUES LESS THAN (3) ENGINE = MyISAM,
PARTITION `p5` VALUES LESS THAN (5) ENGINE = MyISAM,
PARTITION `pMax` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
DROP TABLE t1;
# Same test without partitioning
CREATE TABLE t1 (
......@@ -131,7 +131,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`a`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
PARTITION BY KEY (a)
PARTITION BY KEY (`a`)
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1;
a
......
......@@ -31,8 +31,8 @@ Table Create Table
t2 CREATE TABLE `t2` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (i)
(PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM)
PARTITION BY RANGE (`i`)
(PARTITION `p01` VALUES LESS THAN (1000) ENGINE = MyISAM)
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
CREATE TABLE t1(a INT)
......
......@@ -22,9 +22,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (TO_DAYS(a))
SUBPARTITION BY HASH (to_seconds(a))
(PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM)
PARTITION BY RANGE (to_days(`a`))
SUBPARTITION BY HASH (to_seconds(`a`))
(PARTITION `p0` VALUES LESS THAN (1) ENGINE = MyISAM)
drop table t1;
create table t1 (a int)
partition by range (a)
......@@ -38,8 +38,8 @@ partition p1 VALUES LESS THAN (TO_SECONDS('2007-04-01 00:00:00')));
select partition_method, partition_expression, partition_description
from information_schema.partitions where table_name = "t1";
partition_method partition_expression partition_description
RANGE TO_SECONDS(a) 63340531200
RANGE TO_SECONDS(a) 63342604800
RANGE to_seconds(`a`) 63340531200
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-08 12:00:00'), ('2007-03-15 12:00:00');
explain partitions select * from t1 where a < '2007-03-08 00:00:00';
......@@ -62,9 +62,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (TO_SECONDS(a))
(PARTITION p0 VALUES LESS THAN (63340531200) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (63342604800) ENGINE = MyISAM)
PARTITION BY RANGE (to_seconds(`a`))
(PARTITION `p0` VALUES LESS THAN (63340531200) ENGINE = MyISAM,
PARTITION `p1` VALUES LESS THAN (63342604800) ENGINE = MyISAM)
drop table t1;
create table t1 (a date)
partition by range(to_seconds(a))
......@@ -93,9 +93,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (to_seconds(a))
(PARTITION p0 VALUES LESS THAN (63240134400) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (63271756800) ENGINE = MyISAM)
PARTITION BY RANGE (to_seconds(`a`))
(PARTITION `p0` VALUES LESS THAN (63240134400) ENGINE = MyISAM,
PARTITION `p1` VALUES LESS THAN (63271756800) ENGINE = MyISAM)
drop table t1;
create table t1 (a datetime)
partition by range(to_seconds(a))
......@@ -123,9 +123,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` datetime DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (to_seconds(a))
(PARTITION p0 VALUES LESS THAN (63240177600) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (63271800000) ENGINE = MyISAM)
PARTITION BY RANGE (to_seconds(`a`))
(PARTITION `p0` VALUES LESS THAN (63240177600) ENGINE = MyISAM,
PARTITION `p1` VALUES LESS THAN (63271800000) ENGINE = MyISAM)
drop table t1;
create table t1 (a int, b char(20))
partition by range columns(a,b)
......@@ -153,8 +153,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
PARTITION BY RANGE (`a`)
(PARTITION `p0` VALUES LESS THAN MAXVALUE ENGINE = MyISAM)
drop table t1;
create table t1 (a integer)
partition by range (a)
......@@ -284,10 +284,10 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a)
(PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM,
PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM,
PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM)
PARTITION BY RANGE (`a`)
(PARTITION `x1` VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM,
PARTITION `x2` VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM,
PARTITION `x3` VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM)
ALTER TABLE t1
partition by range (a)
partitions 3
......@@ -308,10 +308,10 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a)
(PARTITION x1 VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM,
PARTITION x2 VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM,
PARTITION x3 VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM)
PARTITION BY RANGE (`a`)
(PARTITION `x1` VALUES LESS THAN (5) TABLESPACE = ts1 ENGINE = MyISAM,
PARTITION `x2` VALUES LESS THAN (10) TABLESPACE = ts2 ENGINE = MyISAM,
PARTITION `x3` VALUES LESS THAN MAXVALUE TABLESPACE = ts3 ENGINE = MyISAM)
drop table if exists t1;
CREATE TABLE t1 (
a int not null,
......@@ -409,14 +409,14 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a+b)
(PARTITION x1 VALUES LESS THAN (1)
(SUBPARTITION x11 ENGINE = MyISAM,
SUBPARTITION x12 ENGINE = MyISAM),
PARTITION x2 VALUES LESS THAN (5)
(SUBPARTITION x21 ENGINE = MyISAM,
SUBPARTITION x22 ENGINE = MyISAM))
PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a` + `b`)
(PARTITION `x1` VALUES LESS THAN (1)
(SUBPARTITION `x11` ENGINE = MyISAM,
SUBPARTITION `x12` ENGINE = MyISAM),
PARTITION `x2` VALUES LESS THAN (5)
(SUBPARTITION `x21` ENGINE = MyISAM,
SUBPARTITION `x22` ENGINE = MyISAM))
ALTER TABLE t1 ADD COLUMN d int;
show create table t1;
Table Create Table
......@@ -427,14 +427,14 @@ t1 CREATE TABLE `t1` (
`d` int(11) DEFAULT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (a+b)
(PARTITION x1 VALUES LESS THAN (1)
(SUBPARTITION x11 ENGINE = MyISAM,
SUBPARTITION x12 ENGINE = MyISAM),
PARTITION x2 VALUES LESS THAN (5)
(SUBPARTITION x21 ENGINE = MyISAM,
SUBPARTITION x22 ENGINE = MyISAM))
PARTITION BY RANGE (`a`)
SUBPARTITION BY HASH (`a` + `b`)
(PARTITION `x1` VALUES LESS THAN (1)
(SUBPARTITION `x11` ENGINE = MyISAM,
SUBPARTITION `x12` ENGINE = MyISAM),
PARTITION `x2` VALUES LESS THAN (5)
(SUBPARTITION `x21` ENGINE = MyISAM,
SUBPARTITION `x22` ENGINE = MyISAM))
drop table t1;
CREATE TABLE t1 (
a int not null,
......@@ -658,9 +658,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (0) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM)
PARTITION BY RANGE (`a`)
(PARTITION `p0` VALUES LESS THAN (0) ENGINE = MyISAM,
PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM)
drop table t1;
create table t1 (a bigint unsigned)
partition by range (a)
......@@ -671,9 +671,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (2) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM)
PARTITION BY RANGE (`a`)
(PARTITION `p0` VALUES LESS THAN (2) ENGINE = MyISAM,
PARTITION `p1` VALUES LESS THAN (10) ENGINE = MyISAM)
insert into t1 values (0xFFFFFFFFFFFFFFFF);
ERROR HY000: Table has no partition for value 18446744073709551615
drop table t1;
......
......@@ -22,10 +22,10 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST (a)
(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 p2 VALUES IN (2) ENGINE = MyISAM)
PARTITION BY LIST (`a`)
(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 `p2` VALUES IN (2) ENGINE = MyISAM)
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
......@@ -158,8 +158,8 @@ Table Create Table
t2 CREATE TABLE `t2` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (i)
(PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM)
PARTITION BY RANGE (`i`)
(PARTITION `p01` VALUES LESS THAN (1000) ENGINE = MyISAM)
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
create table t1 (a int)
......
......@@ -7,8 +7,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN (_cp1250 0x81) ENGINE = MyISAM)
PARTITION BY LIST COLUMNS(`a`)
(PARTITION `p0` VALUES IN (_cp1250 0x81) ENGINE = MyISAM)
drop table t1;
create table t1 (a varchar(2) character set cp1250)
partition by list columns (a)
......@@ -18,8 +18,8 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET cp1250 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN ('€') ENGINE = MyISAM)
PARTITION BY LIST COLUMNS(`a`)
(PARTITION `p0` VALUES IN ('€') ENGINE = MyISAM)
drop table t1;
create table t1 (a varchar(1500), b varchar(1570))
partition by list columns(a,b)
......@@ -45,9 +45,9 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST COLUMNS(a)
(PARTITION p0 VALUES IN ('†') ENGINE = MyISAM,
PARTITION p1 VALUES IN ('') ENGINE = MyISAM)
PARTITION BY LIST COLUMNS(`a`)
(PARTITION `p0` VALUES IN ('†') ENGINE = MyISAM,
PARTITION `p1` VALUES IN ('') ENGINE = MyISAM)
insert into t1 values ('');
insert into t1 values (_ucs2 0x2020);
drop table t1;
......@@ -322,12 +322,12 @@ INSERT INTO t2 VALUES
('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');
table_name partition_name partition_method partition_expression partition_description table_rows
t1 p01 RANGE to_days(taken) 732920 0
t1 p02 RANGE to_days(taken) 732950 7
t1 p03 RANGE to_days(taken) MAXVALUE 3
t2 p01 RANGE extract(microsecond from taken) 123000 3
t2 p02 RANGE extract(microsecond from taken) 500000 4
t2 p03 RANGE extract(microsecond from taken) MAXVALUE 3
t1 p01 RANGE to_days(`taken`) 732920 0
t1 p02 RANGE to_days(`taken`) 732950 7
t1 p03 RANGE to_days(`taken`) MAXVALUE 3
t2 p01 RANGE extract(microsecond from `taken`) 123000 3
t2 p02 RANGE extract(microsecond from `taken`) 500000 4
t2 p03 RANGE extract(microsecond from `taken`) MAXVALUE 3
drop table t1, t2;
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');
......
......@@ -84,7 +84,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
PARTITION BY HASH (a)
PARTITION BY HASH (`a`)
drop table t1;
CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT,
f1 VARCHAR(25),
......@@ -109,20 +109,20 @@ t1 CREATE TABLE `t1` (
`f1` varchar(25) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=ARCHIVE AUTO_INCREMENT=101 DEFAULT CHARSET=latin1
PARTITION BY RANGE (id)
SUBPARTITION BY HASH (id)
PARTITION BY RANGE (`id`)
SUBPARTITION BY HASH (`id`)
SUBPARTITIONS 2
(PARTITION pa1 VALUES LESS THAN (10) ENGINE = ARCHIVE,
PARTITION pa2 VALUES LESS THAN (20) ENGINE = ARCHIVE,
PARTITION pa3 VALUES LESS THAN (30) ENGINE = ARCHIVE,
PARTITION pa4 VALUES LESS THAN (40) ENGINE = ARCHIVE,
PARTITION pa5 VALUES LESS THAN (50) ENGINE = ARCHIVE,
PARTITION pa6 VALUES LESS THAN (60) ENGINE = ARCHIVE,
PARTITION pa7 VALUES LESS THAN (70) ENGINE = ARCHIVE,
PARTITION pa8 VALUES LESS THAN (80) ENGINE = ARCHIVE,
PARTITION pa9 VALUES LESS THAN (90) ENGINE = ARCHIVE,
PARTITION pa10 VALUES LESS THAN (100) ENGINE = ARCHIVE,
PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE)
(PARTITION `pa1` VALUES LESS THAN (10) ENGINE = ARCHIVE,
PARTITION `pa2` VALUES LESS THAN (20) ENGINE = ARCHIVE,
PARTITION `pa3` VALUES LESS THAN (30) ENGINE = ARCHIVE,
PARTITION `pa4` VALUES LESS THAN (40) ENGINE = ARCHIVE,
PARTITION `pa5` VALUES LESS THAN (50) ENGINE = ARCHIVE,
PARTITION `pa6` VALUES LESS THAN (60) ENGINE = ARCHIVE,
PARTITION `pa7` VALUES LESS THAN (70) ENGINE = ARCHIVE,
PARTITION `pa8` VALUES LESS THAN (80) ENGINE = ARCHIVE,
PARTITION `pa9` VALUES LESS THAN (90) ENGINE = ARCHIVE,
PARTITION `pa10` VALUES LESS THAN (100) ENGINE = ARCHIVE,
PARTITION `pa11` VALUES LESS THAN MAXVALUE ENGINE = ARCHIVE)
select count(*) from t1;
count(*)
100
......@@ -138,7 +138,7 @@ t1 CREATE TABLE `t1` (
`fld1` int(11) NOT NULL,
PRIMARY KEY (`fld1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (fld1)
PARTITION BY HASH (`fld1`)
PARTITIONS 5
ALTER TABLE t1 ENGINE= ARCHIVE;
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
......@@ -149,7 +149,7 @@ t1 CREATE TABLE `t1` (
`fld1` int(11) NOT NULL,
PRIMARY KEY (`fld1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY HASH (fld1)
PARTITION BY HASH (`fld1`)
PARTITIONS 5
#Cleanup.
DROP TABLE t1;
......
......@@ -31,7 +31,7 @@ Table Create Table
t4 CREATE TABLE `t4` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes
PARTITION BY HASH (a)
PARTITION BY HASH (`a`)
PARTITIONS 2
alter table t1 encrypted=no;
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
......
......@@ -21,9 +21,9 @@ t1 CREATE TABLE `t1` (
`s1` int(11) NOT NULL,
PRIMARY KEY (`s1`)
) ENGINE=FEDERATED DEFAULT CHARSET=latin1
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 p2 VALUES IN (2,4) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_2' ENGINE = FEDERATED)
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 `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);
select * from t1;
s1
......
......@@ -1002,7 +1002,7 @@ t CREATE TABLE `t` (
KEY `col_date_key` (`col_date_key`,`col_time_key`,`col_datetime_key`),
KEY `col_varchar_key` (`col_varchar_key`,`col_varchar_nokey`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY KEY (col_int_key)
PARTITION BY KEY (`col_int_key`)
PARTITIONS 3
DROP TABLE t;
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` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB)
PARTITION BY KEY (`a`)
(PARTITION `pa1` MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB,
PARTITION `pa2` MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB,
PARTITION `pa3` MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB,
PARTITION `pa4` MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB)
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535);
select * from t1;
a
......@@ -58,7 +58,7 @@ t2 CREATE TABLE `t2` (
`a` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY KEY (a)
PARTITION BY KEY (`a`)
PARTITIONS 8
insert into t2 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
select * from t2;
......@@ -90,7 +90,7 @@ t3 CREATE TABLE `t3` (
`a` bigint(20) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY KEY (a)
PARTITION BY KEY (`a`)
PARTITIONS 7
insert into t3 values (9223372036854775807), (9223372036854775806), (9223372036854775805), (9223372036854775804), (-9223372036854775808), (-9223372036854775807), (1), (-1), (0);
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