Commit b19c1896 authored by unknown's avatar unknown

Merge c-0409e253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/clean-mysql-5.1

into  c-0409e253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/bug19305

parents b5697a5f f6d40961
...@@ -344,25 +344,25 @@ show create table t1; ...@@ -344,25 +344,25 @@ 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 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM)
alter table t1; alter table t1;
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 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM)
alter table t1 engine=myisam; alter table t1 engine=myisam;
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 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM)
alter table t1 engine=heap; alter table t1 engine=heap;
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=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY)
alter table t1 remove partitioning; alter table t1 remove partitioning;
show create table t1; show create table t1;
Table Create Table Table Create Table
...@@ -379,7 +379,7 @@ show create table t1; ...@@ -379,7 +379,7 @@ 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 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM)
alter table t1 add column b int remove partitioning; alter table t1 add column b int remove partitioning;
show create table t1; show create table t1;
Table Create Table Table Create Table
...@@ -396,7 +396,7 @@ Table Create Table ...@@ -396,7 +396,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( 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 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM)
alter table t1 alter table t1
engine=heap engine=heap
partition by key(a) partition by key(a)
...@@ -406,7 +406,7 @@ Table Create Table ...@@ -406,7 +406,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( 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=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY)
alter table t1 engine=myisam, add column c int remove partitioning; alter table t1 engine=myisam, add column c int remove partitioning;
show create table t1; show create table t1;
Table Create Table Table Create Table
...@@ -425,7 +425,7 @@ t1 CREATE TABLE `t1` ( ...@@ -425,7 +425,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL `c` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY)
alter table t1 alter table t1
partition by key (a) partition by key (a)
(partition p0, partition p1); (partition p0, partition p1);
...@@ -435,7 +435,7 @@ t1 CREATE TABLE `t1` ( ...@@ -435,7 +435,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL `c` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY)
alter table t1 alter table t1
engine=heap engine=heap
partition by key (a) partition by key (a)
...@@ -446,7 +446,7 @@ t1 CREATE TABLE `t1` ( ...@@ -446,7 +446,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL, `a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL `c` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY)
alter table t1 alter table t1
partition by key(a) partition by key(a)
(partition p0, partition p1 engine=heap); (partition p0, partition p1 engine=heap);
...@@ -598,7 +598,7 @@ show create table t1; ...@@ -598,7 +598,7 @@ 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 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p0 VALUES LESS THAN (100) (SUBPARTITION p0sp0 ENGINE = MyISAM), PARTITION p1 VALUES LESS THAN (200) (SUBPARTITION subpart21 ENGINE = MyISAM)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) SUBPARTITION BY HASH (a) (PARTITION p0 VALUES LESS THAN (100) (SUBPARTITION p0sp0 ENGINE = MyISAM), PARTITION p1 VALUES LESS THAN (200) (SUBPARTITION subpart21 ENGINE = MyISAM))
drop table t1; drop table t1;
create table t1 (a int) create table t1 (a int)
partition by key (a); partition by key (a);
...@@ -612,7 +612,7 @@ show create table t1; ...@@ -612,7 +612,7 @@ 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 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 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 (a) partition by range (a)
...@@ -913,6 +913,28 @@ insert into t1 values (1); ...@@ -913,6 +913,28 @@ insert into t1 values (1);
create index inx1 on t1(a); create index inx1 on t1(a);
drop table t1; drop table t1;
create table t1 (a int) create table t1 (a int)
PARTITION BY KEY (a)
(PARTITION p0);
set session sql_mode='no_table_options';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) PARTITION BY KEY (a) (PARTITION p0)
set session sql_mode='';
drop table t1;
create table t1 (a int)
partition by key (a)
(partition p1 engine = innodb);
alter table t1 rebuild partition p1;
alter table t1 rebuild partition p1;
alter table t1 rebuild partition p1;
alter table t1 rebuild partition p1;
alter table t1 rebuild partition p1;
alter table t1 rebuild partition p1;
alter table t1 rebuild partition p1;
drop table t1;
create table t1 (a int)
partition by key (a) partition by key (a)
(partition p0 engine = MERGE); (partition p0 engine = MERGE);
ERROR HY000: MyISAM Merge handler cannot be used in partitioned tables ERROR HY000: MyISAM Merge handler cannot be used in partitioned tables
......
This diff is collapsed.
SET @max_row = 20;
DROP TABLE IF EXISTS t0_template;
CREATE TABLE t0_template (
f_int1 INTEGER,
f_int2 INTEGER,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000) ,
PRIMARY KEY(f_int1))
ENGINE = MEMORY;
INSERT INTO t0_template
SET f_int1 = 20, f_int2 = 20, f_char1 = '20', f_char2 = '20',
f_charbig = '===20===';
INSERT INTO t0_template
SET f_int1 = 19, f_int2 = 19, f_char1 = '19', f_char2 = '19',
f_charbig = '===19===';
INSERT INTO t0_template
SET f_int1 = 18, f_int2 = 18, f_char1 = '18', f_char2 = '18',
f_charbig = '===18===';
INSERT INTO t0_template
SET f_int1 = 17, f_int2 = 17, f_char1 = '17', f_char2 = '17',
f_charbig = '===17===';
INSERT INTO t0_template
SET f_int1 = 16, f_int2 = 16, f_char1 = '16', f_char2 = '16',
f_charbig = '===16===';
INSERT INTO t0_template
SET f_int1 = 15, f_int2 = 15, f_char1 = '15', f_char2 = '15',
f_charbig = '===15===';
INSERT INTO t0_template
SET f_int1 = 14, f_int2 = 14, f_char1 = '14', f_char2 = '14',
f_charbig = '===14===';
INSERT INTO t0_template
SET f_int1 = 13, f_int2 = 13, f_char1 = '13', f_char2 = '13',
f_charbig = '===13===';
INSERT INTO t0_template
SET f_int1 = 12, f_int2 = 12, f_char1 = '12', f_char2 = '12',
f_charbig = '===12===';
INSERT INTO t0_template
SET f_int1 = 11, f_int2 = 11, f_char1 = '11', f_char2 = '11',
f_charbig = '===11===';
INSERT INTO t0_template
SET f_int1 = 10, f_int2 = 10, f_char1 = '10', f_char2 = '10',
f_charbig = '===10===';
INSERT INTO t0_template
SET f_int1 = 9, f_int2 = 9, f_char1 = '9', f_char2 = '9',
f_charbig = '===9===';
INSERT INTO t0_template
SET f_int1 = 8, f_int2 = 8, f_char1 = '8', f_char2 = '8',
f_charbig = '===8===';
INSERT INTO t0_template
SET f_int1 = 7, f_int2 = 7, f_char1 = '7', f_char2 = '7',
f_charbig = '===7===';
INSERT INTO t0_template
SET f_int1 = 6, f_int2 = 6, f_char1 = '6', f_char2 = '6',
f_charbig = '===6===';
INSERT INTO t0_template
SET f_int1 = 5, f_int2 = 5, f_char1 = '5', f_char2 = '5',
f_charbig = '===5===';
INSERT INTO t0_template
SET f_int1 = 4, f_int2 = 4, f_char1 = '4', f_char2 = '4',
f_charbig = '===4===';
INSERT INTO t0_template
SET f_int1 = 3, f_int2 = 3, f_char1 = '3', f_char2 = '3',
f_charbig = '===3===';
INSERT INTO t0_template
SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2',
f_charbig = '===2===';
INSERT INTO t0_template
SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1',
f_charbig = '===1===';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30)) engine='InnoDB';
INSERT INTO t1 (f_date, f_varchar)
SELECT CONCAT(CAST((f_int1 + 999) AS CHAR),'-02-10'), CAST(f_char1 AS CHAR)
FROM t0_template
WHERE f_int1 + 999 BETWEEN 1000 AND 9999;
SELECT IF(9999 - 1000 + 1 > @max_row, @max_row , 9999 - 1000 + 1)
INTO @exp_row_count;
ALTER TABLE t1 PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER));
# 1.1.5 Add two named partitions + test
ALTER TABLE t1 ADD PARTITION (PARTITION part1, PARTITION part7);
drop table t1;
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
ENGINE=InnoDB
PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER));
# This statement crashes the server.
# CREATE partitioned table with three partitions in one step
# would be harmless.
ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
DROP VIEW IF EXISTS v1;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t0_aux;
DROP TABLE IF EXISTS t0_definition;
DROP TABLE IF EXISTS t0_template;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_date` date DEFAULT NULL,
`f_varchar` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2
/home/pappa/bug19305/mysql-test/var/master-data/test/t1#P#p0.MYD
/home/pappa/bug19305/mysql-test/var/master-data/test/t1#P#p0.MYI
/home/pappa/bug19305/mysql-test/var/master-data/test/t1#P#p1.MYD
/home/pappa/bug19305/mysql-test/var/master-data/test/t1#P#p1.MYI
/home/pappa/bug19305/mysql-test/var/master-data/test/t1.frm
/home/pappa/bug19305/mysql-test/var/master-data/test/t1.par
ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f_date` date DEFAULT NULL,
`f_varchar` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 1
/home/pappa/bug19305/mysql-test/var/master-data/test/t1#P#p0.MYD
/home/pappa/bug19305/mysql-test/var/master-data/test/t1#P#p0.MYI
/home/pappa/bug19305/mysql-test/var/master-data/test/t1.frm
/home/pappa/bug19305/mysql-test/var/master-data/test/t1.par
...@@ -143,7 +143,7 @@ t1 CREATE TABLE `t1` ( ...@@ -143,7 +143,7 @@ t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL, `b` int(11) NOT NULL,
`c` int(11) NOT NULL, `c` int(11) NOT NULL,
PRIMARY KEY (`a`,`b`) 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)) ) 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))
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
...@@ -153,7 +153,7 @@ t1 CREATE TABLE `t1` ( ...@@ -153,7 +153,7 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL, `c` int(11) NOT NULL,
`d` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL,
PRIMARY KEY (`a`,`b`) 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)) ) 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))
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
...@@ -387,3 +387,108 @@ ALTER TABLE t1 DROP PARTITION p0; ...@@ -387,3 +387,108 @@ ALTER TABLE t1 DROP PARTITION p0;
ALTER TABLE t1 DROP PARTITION p1; ALTER TABLE t1 DROP PARTITION p1;
ALTER TABLE t1 DROP PARTITION p2; ALTER TABLE t1 DROP PARTITION p2;
drop table t1; drop table t1;
create table t1 (a int DEFAULT NULL,
b varchar(30) DEFAULT NULL,
c date DEFAULT NULL)
ENGINE=MYISAM DEFAULT CHARSET=latin1;
insert into t1 values (1, 'abc', '1995-01-01');
insert into t1 values (1, 'abc', '1995-01-02');
insert into t1 values (1, 'abc', '1995-01-03');
insert into t1 values (1, 'abc', '1995-01-04');
insert into t1 values (1, 'abc', '1995-01-05');
insert into t1 values (1, 'abc', '1995-01-06');
insert into t1 values (1, 'abc', '1995-01-07');
insert into t1 values (1, 'abc', '1995-01-08');
insert into t1 values (1, 'abc', '1995-01-09');
insert into t1 values (1, 'abc', '1995-01-10');
insert into t1 values (1, 'abc', '1995-01-11');
insert into t1 values (1, 'abc', '1995-01-12');
insert into t1 values (1, 'abc', '1995-01-13');
insert into t1 values (1, 'abc', '1995-01-14');
insert into t1 values (1, 'abc', '1995-01-15');
insert into t1 values (1, 'abc', '1997-01-01');
insert into t1 values (1, 'abc', '1997-01-02');
insert into t1 values (1, 'abc', '1997-01-03');
insert into t1 values (1, 'abc', '1997-01-04');
insert into t1 values (1, 'abc', '1997-01-05');
insert into t1 values (1, 'abc', '1997-01-06');
insert into t1 values (1, 'abc', '1997-01-07');
insert into t1 values (1, 'abc', '1997-01-08');
insert into t1 values (1, 'abc', '1997-01-09');
insert into t1 values (1, 'abc', '1997-01-10');
insert into t1 values (1, 'abc', '1997-01-11');
insert into t1 values (1, 'abc', '1997-01-12');
insert into t1 values (1, 'abc', '1997-01-13');
insert into t1 values (1, 'abc', '1997-01-14');
insert into t1 values (1, 'abc', '1997-01-15');
insert into t1 values (1, 'abc', '1998-01-01');
insert into t1 values (1, 'abc', '1998-01-02');
insert into t1 values (1, 'abc', '1998-01-03');
insert into t1 values (1, 'abc', '1998-01-04');
insert into t1 values (1, 'abc', '1998-01-05');
insert into t1 values (1, 'abc', '1998-01-06');
insert into t1 values (1, 'abc', '1998-01-07');
insert into t1 values (1, 'abc', '1998-01-08');
insert into t1 values (1, 'abc', '1998-01-09');
insert into t1 values (1, 'abc', '1998-01-10');
insert into t1 values (1, 'abc', '1998-01-11');
insert into t1 values (1, 'abc', '1998-01-12');
insert into t1 values (1, 'abc', '1998-01-13');
insert into t1 values (1, 'abc', '1998-01-14');
insert into t1 values (1, 'abc', '1998-01-15');
insert into t1 values (1, 'abc', '1999-01-01');
insert into t1 values (1, 'abc', '1999-01-02');
insert into t1 values (1, 'abc', '1999-01-03');
insert into t1 values (1, 'abc', '1999-01-04');
insert into t1 values (1, 'abc', '1999-01-05');
insert into t1 values (1, 'abc', '1999-01-06');
insert into t1 values (1, 'abc', '1999-01-07');
insert into t1 values (1, 'abc', '1999-01-08');
insert into t1 values (1, 'abc', '1999-01-09');
insert into t1 values (1, 'abc', '1999-01-10');
insert into t1 values (1, 'abc', '1999-01-11');
insert into t1 values (1, 'abc', '1999-01-12');
insert into t1 values (1, 'abc', '1999-01-13');
insert into t1 values (1, 'abc', '1999-01-14');
insert into t1 values (1, 'abc', '1999-01-15');
insert into t1 values (1, 'abc', '2000-01-01');
insert into t1 values (1, 'abc', '2000-01-02');
insert into t1 values (1, 'abc', '2000-01-03');
insert into t1 values (1, 'abc', '2000-01-04');
insert into t1 values (1, 'abc', '2000-01-05');
insert into t1 values (1, 'abc', '2000-01-06');
insert into t1 values (1, 'abc', '2000-01-07');
insert into t1 values (1, 'abc', '2000-01-08');
insert into t1 values (1, 'abc', '2000-01-09');
insert into t1 values (1, 'abc', '2000-01-15');
insert into t1 values (1, 'abc', '2000-01-11');
insert into t1 values (1, 'abc', '2000-01-12');
insert into t1 values (1, 'abc', '2000-01-13');
insert into t1 values (1, 'abc', '2000-01-14');
insert into t1 values (1, 'abc', '2000-01-15');
insert into t1 values (1, 'abc', '2001-01-01');
insert into t1 values (1, 'abc', '2001-01-02');
insert into t1 values (1, 'abc', '2001-01-03');
insert into t1 values (1, 'abc', '2001-01-04');
insert into t1 values (1, 'abc', '2001-01-05');
insert into t1 values (1, 'abc', '2001-01-06');
insert into t1 values (1, 'abc', '2001-01-07');
insert into t1 values (1, 'abc', '2001-01-08');
insert into t1 values (1, 'abc', '2001-01-09');
insert into t1 values (1, 'abc', '2001-01-15');
insert into t1 values (1, 'abc', '2001-01-11');
insert into t1 values (1, 'abc', '2001-01-12');
insert into t1 values (1, 'abc', '2001-01-13');
insert into t1 values (1, 'abc', '2001-01-14');
insert into t1 values (1, 'abc', '2001-01-15');
alter table t1
partition by range (year(c))
(partition p5 values less than (2000), partition p10 values less than (2010));
alter table t1
reorganize partition p5 into
(partition p1 values less than (1996),
partition p2 values less than (1997),
partition p3 values less than (1998),
partition p4 values less than (1999),
partition p5 values less than (2000));
drop table t1;
...@@ -1036,6 +1036,34 @@ insert into t1 values (1); ...@@ -1036,6 +1036,34 @@ insert into t1 values (1);
create index inx1 on t1(a); create index inx1 on t1(a);
drop table t1; drop table t1;
#
# Bug 19695 Partitions: SHOW CREATE TABLE shows table options even when it
# shouldn't
#
create table t1 (a int)
PARTITION BY KEY (a)
(PARTITION p0);
set session sql_mode='no_table_options';
show create table t1;
set session sql_mode='';
drop table t1;
#
# BUG 19122 Crash after ALTER TABLE t1 REBUILD PARTITION p1
#
create table t1 (a int)
partition by key (a)
(partition p1 engine = innodb);
alter table t1 rebuild partition p1;
alter table t1 rebuild partition p1;
alter table t1 rebuild partition p1;
alter table t1 rebuild partition p1;
alter table t1 rebuild partition p1;
alter table t1 rebuild partition p1;
alter table t1 rebuild partition p1;
drop table t1;
# #
# BUG 19304 Partitions: MERGE handler not allowed in partitioned tables # BUG 19304 Partitions: MERGE handler not allowed in partitioned tables
# #
......
-- source include/have_innodb.inc
SET @max_row = 20;
let $engine= 'InnoDB';
let $MAX_VALUE= (2147483646);
let $max_row= `SELECT @max_row`;
# Column list with definition for all tables to be checked
let $column_list= f_int1 INTEGER,
f_int2 INTEGER,
f_char1 CHAR(20),
f_char2 CHAR(20),
f_charbig VARCHAR(1000);
let $sub_part_no= 3;
--disable_warnings
DROP TABLE IF EXISTS t0_template;
--enable_warnings
eval CREATE TABLE t0_template (
$column_list ,
PRIMARY KEY(f_int1))
ENGINE = MEMORY;
let $num= `SELECT @max_row`;
while ($num)
{
eval INSERT INTO t0_template
SET f_int1 = $num, f_int2 = $num, f_char1 = '$num', f_char2 = '$num',
f_charbig = '===$num===';
dec $num;
}
# 1. Create the table
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
eval CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30)) engine=$engine;
# 2. Fill the table t1 with records
INSERT INTO t1 (f_date, f_varchar)
SELECT CONCAT(CAST((f_int1 + 999) AS CHAR),'-02-10'), CAST(f_char1 AS CHAR)
FROM t0_template
WHERE f_int1 + 999 BETWEEN 1000 AND 9999;
# 3. Calculate the number of inserted records.
SELECT IF(9999 - 1000 + 1 > @max_row, @max_row , 9999 - 1000 + 1)
INTO @exp_row_count;
# DEBUG SELECT @exp_row_count;
# 4. Print the layout, check Readability
ALTER TABLE t1 PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER));
--echo # 1.1.5 Add two named partitions + test
ALTER TABLE t1 ADD PARTITION (PARTITION part1, PARTITION part7);
drop table t1;
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
ENGINE=InnoDB
PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER));
--echo # This statement crashes the server.
--echo # CREATE partitioned table with three partitions in one step
--echo # would be harmless.
ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
--disable_warnings
DROP VIEW IF EXISTS v1;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t0_aux;
DROP TABLE IF EXISTS t0_definition;
DROP TABLE IF EXISTS t0_template;
--enable_warnings
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
PARTITION BY HASH(CAST(YEAR(f_date) AS SIGNED INTEGER)) PARTITIONS 2;
SHOW CREATE TABLE t1;
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1*
...@@ -416,3 +416,117 @@ ALTER TABLE t1 DROP PARTITION p0; ...@@ -416,3 +416,117 @@ ALTER TABLE t1 DROP PARTITION p0;
ALTER TABLE t1 DROP PARTITION p1; ALTER TABLE t1 DROP PARTITION p1;
ALTER TABLE t1 DROP PARTITION p2; ALTER TABLE t1 DROP PARTITION p2;
drop table t1; drop table t1;
#
# Bug 19830: ALTER TABLE t1 REORGANIZE PARTITION crashes
#
create table t1 (a int DEFAULT NULL,
b varchar(30) DEFAULT NULL,
c date DEFAULT NULL)
ENGINE=MYISAM DEFAULT CHARSET=latin1;
insert into t1 values (1, 'abc', '1995-01-01');
insert into t1 values (1, 'abc', '1995-01-02');
insert into t1 values (1, 'abc', '1995-01-03');
insert into t1 values (1, 'abc', '1995-01-04');
insert into t1 values (1, 'abc', '1995-01-05');
insert into t1 values (1, 'abc', '1995-01-06');
insert into t1 values (1, 'abc', '1995-01-07');
insert into t1 values (1, 'abc', '1995-01-08');
insert into t1 values (1, 'abc', '1995-01-09');
insert into t1 values (1, 'abc', '1995-01-10');
insert into t1 values (1, 'abc', '1995-01-11');
insert into t1 values (1, 'abc', '1995-01-12');
insert into t1 values (1, 'abc', '1995-01-13');
insert into t1 values (1, 'abc', '1995-01-14');
insert into t1 values (1, 'abc', '1995-01-15');
insert into t1 values (1, 'abc', '1997-01-01');
insert into t1 values (1, 'abc', '1997-01-02');
insert into t1 values (1, 'abc', '1997-01-03');
insert into t1 values (1, 'abc', '1997-01-04');
insert into t1 values (1, 'abc', '1997-01-05');
insert into t1 values (1, 'abc', '1997-01-06');
insert into t1 values (1, 'abc', '1997-01-07');
insert into t1 values (1, 'abc', '1997-01-08');
insert into t1 values (1, 'abc', '1997-01-09');
insert into t1 values (1, 'abc', '1997-01-10');
insert into t1 values (1, 'abc', '1997-01-11');
insert into t1 values (1, 'abc', '1997-01-12');
insert into t1 values (1, 'abc', '1997-01-13');
insert into t1 values (1, 'abc', '1997-01-14');
insert into t1 values (1, 'abc', '1997-01-15');
insert into t1 values (1, 'abc', '1998-01-01');
insert into t1 values (1, 'abc', '1998-01-02');
insert into t1 values (1, 'abc', '1998-01-03');
insert into t1 values (1, 'abc', '1998-01-04');
insert into t1 values (1, 'abc', '1998-01-05');
insert into t1 values (1, 'abc', '1998-01-06');
insert into t1 values (1, 'abc', '1998-01-07');
insert into t1 values (1, 'abc', '1998-01-08');
insert into t1 values (1, 'abc', '1998-01-09');
insert into t1 values (1, 'abc', '1998-01-10');
insert into t1 values (1, 'abc', '1998-01-11');
insert into t1 values (1, 'abc', '1998-01-12');
insert into t1 values (1, 'abc', '1998-01-13');
insert into t1 values (1, 'abc', '1998-01-14');
insert into t1 values (1, 'abc', '1998-01-15');
insert into t1 values (1, 'abc', '1999-01-01');
insert into t1 values (1, 'abc', '1999-01-02');
insert into t1 values (1, 'abc', '1999-01-03');
insert into t1 values (1, 'abc', '1999-01-04');
insert into t1 values (1, 'abc', '1999-01-05');
insert into t1 values (1, 'abc', '1999-01-06');
insert into t1 values (1, 'abc', '1999-01-07');
insert into t1 values (1, 'abc', '1999-01-08');
insert into t1 values (1, 'abc', '1999-01-09');
insert into t1 values (1, 'abc', '1999-01-10');
insert into t1 values (1, 'abc', '1999-01-11');
insert into t1 values (1, 'abc', '1999-01-12');
insert into t1 values (1, 'abc', '1999-01-13');
insert into t1 values (1, 'abc', '1999-01-14');
insert into t1 values (1, 'abc', '1999-01-15');
insert into t1 values (1, 'abc', '2000-01-01');
insert into t1 values (1, 'abc', '2000-01-02');
insert into t1 values (1, 'abc', '2000-01-03');
insert into t1 values (1, 'abc', '2000-01-04');
insert into t1 values (1, 'abc', '2000-01-05');
insert into t1 values (1, 'abc', '2000-01-06');
insert into t1 values (1, 'abc', '2000-01-07');
insert into t1 values (1, 'abc', '2000-01-08');
insert into t1 values (1, 'abc', '2000-01-09');
insert into t1 values (1, 'abc', '2000-01-15');
insert into t1 values (1, 'abc', '2000-01-11');
insert into t1 values (1, 'abc', '2000-01-12');
insert into t1 values (1, 'abc', '2000-01-13');
insert into t1 values (1, 'abc', '2000-01-14');
insert into t1 values (1, 'abc', '2000-01-15');
insert into t1 values (1, 'abc', '2001-01-01');
insert into t1 values (1, 'abc', '2001-01-02');
insert into t1 values (1, 'abc', '2001-01-03');
insert into t1 values (1, 'abc', '2001-01-04');
insert into t1 values (1, 'abc', '2001-01-05');
insert into t1 values (1, 'abc', '2001-01-06');
insert into t1 values (1, 'abc', '2001-01-07');
insert into t1 values (1, 'abc', '2001-01-08');
insert into t1 values (1, 'abc', '2001-01-09');
insert into t1 values (1, 'abc', '2001-01-15');
insert into t1 values (1, 'abc', '2001-01-11');
insert into t1 values (1, 'abc', '2001-01-12');
insert into t1 values (1, 'abc', '2001-01-13');
insert into t1 values (1, 'abc', '2001-01-14');
insert into t1 values (1, 'abc', '2001-01-15');
alter table t1
partition by range (year(c))
(partition p5 values less than (2000), partition p10 values less than (2010));
alter table t1
reorganize partition p5 into
(partition p1 values less than (1996),
partition p2 values less than (1997),
partition p3 values less than (1998),
partition p4 values less than (1999),
partition p5 values less than (2000));
drop table t1;
...@@ -611,6 +611,8 @@ int ha_partition::drop_partitions(const char *path) ...@@ -611,6 +611,8 @@ int ha_partition::drop_partitions(const char *path)
DBUG_PRINT("info", ("Drop subpartition %s", part_name_buff)); DBUG_PRINT("info", ("Drop subpartition %s", part_name_buff));
if ((ret_error= file->delete_table((const char *) part_name_buff))) if ((ret_error= file->delete_table((const char *) part_name_buff)))
error= ret_error; error= ret_error;
if (deactivate_ddl_log_entry(sub_elem->log_entry->entry_pos))
error= 1;
} while (++j < no_subparts); } while (++j < no_subparts);
} }
else else
...@@ -622,6 +624,8 @@ int ha_partition::drop_partitions(const char *path) ...@@ -622,6 +624,8 @@ int ha_partition::drop_partitions(const char *path)
DBUG_PRINT("info", ("Drop partition %s", part_name_buff)); DBUG_PRINT("info", ("Drop partition %s", part_name_buff));
if ((ret_error= file->delete_table((const char *) part_name_buff))) if ((ret_error= file->delete_table((const char *) part_name_buff)))
error= ret_error; error= ret_error;
if (deactivate_ddl_log_entry(part_elem->log_entry->entry_pos))
error= 1;
} }
if (part_elem->part_state == PART_IS_CHANGED) if (part_elem->part_state == PART_IS_CHANGED)
part_elem->part_state= PART_NORMAL; part_elem->part_state= PART_NORMAL;
...@@ -629,6 +633,7 @@ int ha_partition::drop_partitions(const char *path) ...@@ -629,6 +633,7 @@ int ha_partition::drop_partitions(const char *path)
part_elem->part_state= PART_IS_DROPPED; part_elem->part_state= PART_IS_DROPPED;
} }
} while (++i < no_parts); } while (++i < no_parts);
VOID(sync_ddl_log());
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -745,6 +750,7 @@ int ha_partition::rename_partitions(const char *path) ...@@ -745,6 +750,7 @@ int ha_partition::rename_partitions(const char *path)
*/ */
part_elem= part_it++; part_elem= part_it++;
if (part_elem->part_state == PART_IS_CHANGED || if (part_elem->part_state == PART_IS_CHANGED ||
part_elem->part_state == PART_TO_BE_DROPPED ||
(part_elem->part_state == PART_IS_ADDED && temp_partitions)) (part_elem->part_state == PART_IS_ADDED && temp_partitions))
{ {
if (m_is_sub_partitioned) if (m_is_sub_partitioned)
......
...@@ -828,7 +828,7 @@ int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list) ...@@ -828,7 +828,7 @@ int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list)
if (wait_if_global_read_lock(thd, 0, 1)) if (wait_if_global_read_lock(thd, 0, 1))
DBUG_RETURN(1); DBUG_RETURN(1);
VOID(pthread_mutex_lock(&LOCK_open)); VOID(pthread_mutex_lock(&LOCK_open));
if ((lock_retcode = lock_table_name(thd, table_list)) < 0) if ((lock_retcode = lock_table_name(thd, table_list, TRUE)) < 0)
goto end; goto end;
if (lock_retcode && wait_for_locked_table_names(thd, table_list)) if (lock_retcode && wait_for_locked_table_names(thd, table_list))
{ {
...@@ -851,6 +851,7 @@ int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list) ...@@ -851,6 +851,7 @@ int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list)
lock_table_name() lock_table_name()
thd Thread handler thd Thread handler
table_list Lock first table in this list table_list Lock first table in this list
check_in_use Do we need to check if table already in use by us
WARNING WARNING
If you are going to update the table, you should use If you are going to update the table, you should use
...@@ -870,7 +871,7 @@ int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list) ...@@ -870,7 +871,7 @@ int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list)
> 0 table locked, but someone is using it > 0 table locked, but someone is using it
*/ */
int lock_table_name(THD *thd, TABLE_LIST *table_list) int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use)
{ {
TABLE *table; TABLE *table;
char key[MAX_DBKEY_LENGTH]; char key[MAX_DBKEY_LENGTH];
...@@ -882,17 +883,22 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list) ...@@ -882,17 +883,22 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
key_length= create_table_def_key(thd, key, table_list, 0); key_length= create_table_def_key(thd, key, table_list, 0);
/* Only insert the table if we haven't insert it already */ if (check_in_use)
for (table=(TABLE*) hash_first(&open_cache, (byte*)key, key_length, &state);
table ;
table = (TABLE*) hash_next(&open_cache,(byte*) key,key_length, &state))
{ {
if (table->in_use == thd) /* Only insert the table if we haven't insert it already */
for (table=(TABLE*) hash_first(&open_cache, (byte*)key,
key_length, &state);
table ;
table = (TABLE*) hash_next(&open_cache,(byte*) key,
key_length, &state))
{ {
DBUG_PRINT("info", ("Table is in use")); if (table->in_use == thd)
table->s->version= 0; // Ensure no one can use this {
table->locked_by_name= 1; DBUG_PRINT("info", ("Table is in use"));
DBUG_RETURN(0); table->s->version= 0; // Ensure no one can use this
table->locked_by_name= 1;
DBUG_RETURN(0);
}
} }
} }
/* /*
...@@ -917,10 +923,10 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list) ...@@ -917,10 +923,10 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
my_free((gptr) table,MYF(0)); my_free((gptr) table,MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
/* Return 1 if table is in use */ /* Return 1 if table is in use */
DBUG_RETURN(test(remove_table_from_cache(thd, db, table_list->table_name, DBUG_RETURN(test(remove_table_from_cache(thd, db, table_list->table_name,
RTFC_NO_FLAG))); check_in_use ? RTFC_NO_FLAG : RTFC_WAIT_OTHER_THREAD_FLAG)));
} }
...@@ -1003,7 +1009,7 @@ bool lock_table_names(THD *thd, TABLE_LIST *table_list) ...@@ -1003,7 +1009,7 @@ bool lock_table_names(THD *thd, TABLE_LIST *table_list)
for (lock_table= table_list; lock_table; lock_table= lock_table->next_local) for (lock_table= table_list; lock_table; lock_table= lock_table->next_local)
{ {
int got_lock; int got_lock;
if ((got_lock=lock_table_name(thd,lock_table)) < 0) if ((got_lock=lock_table_name(thd,lock_table, TRUE)) < 0)
goto end; // Fatal error goto end; // Fatal error
if (got_lock) if (got_lock)
got_all_locks=0; // Someone is using table got_all_locks=0; // Someone is using table
......
...@@ -1174,7 +1174,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, ...@@ -1174,7 +1174,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
HA_CREATE_INFO *create_info, HA_CREATE_INFO *create_info,
TABLE_LIST *table_list, TABLE_LIST *table_list,
List<create_field> *create_list, List<create_field> *create_list,
List<Key> *key_list, const char *db, List<Key> *key_list, char *db,
const char *table_name, const char *table_name,
uint fast_alter_partition); uint fast_alter_partition);
uint prep_alter_part_table(THD *thd, TABLE *table, ALTER_INFO *alter_info, uint prep_alter_part_table(THD *thd, TABLE *table, ALTER_INFO *alter_info,
...@@ -1204,10 +1204,12 @@ void create_subpartition_name(char *out, const char *in1, ...@@ -1204,10 +1204,12 @@ void create_subpartition_name(char *out, const char *in1,
typedef struct st_lock_param_type typedef struct st_lock_param_type
{ {
TABLE_LIST table_list;
ulonglong copied; ulonglong copied;
ulonglong deleted; ulonglong deleted;
THD *thd; THD *thd;
HA_CREATE_INFO *create_info; HA_CREATE_INFO *create_info;
ALTER_INFO *alter_info;
List<create_field> *create_list; List<create_field> *create_list;
List<create_field> new_create_list; List<create_field> new_create_list;
List<Key> *key_list; List<Key> *key_list;
...@@ -1687,7 +1689,7 @@ void unset_protect_against_global_read_lock(void); ...@@ -1687,7 +1689,7 @@ void unset_protect_against_global_read_lock(void);
/* Lock based on name */ /* Lock based on name */
int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list); int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list);
int lock_table_name(THD *thd, TABLE_LIST *table_list); int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use);
void unlock_table_name(THD *thd, TABLE_LIST *table_list); void unlock_table_name(THD *thd, TABLE_LIST *table_list);
bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list); bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list);
bool lock_table_names(THD *thd, TABLE_LIST *table_list); bool lock_table_names(THD *thd, TABLE_LIST *table_list);
......
...@@ -2686,7 +2686,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, TABLE_LIST *table_list, ...@@ -2686,7 +2686,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, TABLE_LIST *table_list,
goto err; goto err;
// Code below is for repairing a crashed file // Code below is for repairing a crashed file
if ((error= lock_table_name(thd, table_list))) if ((error= lock_table_name(thd, table_list, TRUE)))
{ {
if (error < 0) if (error < 0)
goto err; goto err;
......
This diff is collapsed.
...@@ -69,7 +69,8 @@ bool check_partition_info(partition_info *part_info,handlerton **eng_type, ...@@ -69,7 +69,8 @@ bool check_partition_info(partition_info *part_info,handlerton **eng_type,
bool fix_partition_func(THD *thd, const char *name, TABLE *table, bool fix_partition_func(THD *thd, const char *name, TABLE *table,
bool create_table_ind); bool create_table_ind);
char *generate_partition_syntax(partition_info *part_info, char *generate_partition_syntax(partition_info *part_info,
uint *buf_length, bool use_sql_alloc); uint *buf_length, bool use_sql_alloc,
bool show_partition_options);
bool partition_key_modified(TABLE *table, List<Item> &fields); bool partition_key_modified(TABLE *table, List<Item> &fields);
void get_partition_set(const TABLE *table, byte *buf, const uint index, void get_partition_set(const TABLE *table, byte *buf, const uint index,
const key_range *key_spec, const key_range *key_spec,
......
...@@ -970,6 +970,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, ...@@ -970,6 +970,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
handler *file= table->file; handler *file= table->file;
TABLE_SHARE *share= table->s; TABLE_SHARE *share= table->s;
HA_CREATE_INFO create_info; HA_CREATE_INFO create_info;
bool show_table_options= FALSE;
bool foreign_db_mode= (thd->variables.sql_mode & (MODE_POSTGRESQL | bool foreign_db_mode= (thd->variables.sql_mode & (MODE_POSTGRESQL |
MODE_ORACLE | MODE_ORACLE |
MODE_MSSQL | MODE_MSSQL |
...@@ -1195,6 +1196,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, ...@@ -1195,6 +1196,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
packet->append(STRING_WITH_LEN("\n)")); packet->append(STRING_WITH_LEN("\n)"));
if (!(thd->variables.sql_mode & MODE_NO_TABLE_OPTIONS) && !foreign_db_mode) if (!(thd->variables.sql_mode & MODE_NO_TABLE_OPTIONS) && !foreign_db_mode)
{ {
show_table_options= TRUE;
/* /*
Get possible table space definitions and append them Get possible table space definitions and append them
to the CREATE TABLE statement to the CREATE TABLE statement
...@@ -1335,7 +1337,8 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, ...@@ -1335,7 +1337,8 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
(!table->part_info->is_auto_partitioned) && (!table->part_info->is_auto_partitioned) &&
((part_syntax= generate_partition_syntax(table->part_info, ((part_syntax= generate_partition_syntax(table->part_info,
&part_syntax_len, &part_syntax_len,
FALSE)))) FALSE,
show_table_options))))
{ {
packet->append(part_syntax, part_syntax_len); packet->append(part_syntax, part_syntax_len);
my_free(part_syntax, MYF(0)); my_free(part_syntax, MYF(0));
......
...@@ -1233,7 +1233,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) ...@@ -1233,7 +1233,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
{ {
if (!(part_syntax_buf= generate_partition_syntax(part_info, if (!(part_syntax_buf= generate_partition_syntax(part_info,
&syntax_len, &syntax_len,
TRUE))) TRUE, TRUE)))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -3155,7 +3155,7 @@ bool mysql_create_table_internal(THD *thd, ...@@ -3155,7 +3155,7 @@ bool mysql_create_table_internal(THD *thd,
*/ */
if (!(part_syntax_buf= generate_partition_syntax(part_info, if (!(part_syntax_buf= generate_partition_syntax(part_info,
&syntax_len, &syntax_len,
TRUE))) TRUE, TRUE)))
goto err; goto err;
part_info->part_info_string= part_syntax_buf; part_info->part_info_string= part_syntax_buf;
part_info->part_info_len= syntax_len; part_info->part_info_len= syntax_len;
......
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