Commit 3247d60d 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/bug19695


BitKeeper/deleted/.del-ndb_partition_key.result~68b9a59cff8c9840:
  Auto merged
mysql-test/r/partition.result:
  manual merge
mysql-test/r/partition_02myisam.result:
  manual merge
mysql-test/t/partition.test:
  manual merge
sql/sql_partition.cc:
  manual merge
sql/sql_partition.h:
  manual merge
sql/sql_show.cc:
  manual merge
sql/sql_table.cc:
  manual merge
parents 12655063 a3170bf6
...@@ -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)
...@@ -907,6 +907,17 @@ s1 ...@@ -907,6 +907,17 @@ s1
2 2
3 3
drop table t1; drop table t1;
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) engine=memory create table t1 (a int) engine=memory
partition by key(a); partition by key(a);
insert into t1 values (1); insert into t1 values (1);
......
...@@ -147,7 +147,7 @@ Table Create Table ...@@ -147,7 +147,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
SELECT COUNT(*) = 0 AS my_value FROM t1; SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value my_value
1 1
...@@ -205,7 +205,7 @@ Table Create Table ...@@ -205,7 +205,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
SELECT COUNT(*) = 0 AS my_value FROM t1; SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value my_value
1 1
...@@ -260,7 +260,7 @@ Table Create Table ...@@ -260,7 +260,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
SELECT COUNT(*) = 0 AS my_value FROM t1; SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value my_value
1 1
...@@ -313,7 +313,7 @@ Table Create Table ...@@ -313,7 +313,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
SELECT COUNT(*) = 0 AS my_value FROM t1; SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value my_value
1 1
...@@ -371,7 +371,7 @@ Table Create Table ...@@ -371,7 +371,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
SELECT COUNT(*) = 0 AS my_value FROM t1; SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value my_value
1 1
...@@ -429,7 +429,7 @@ Table Create Table ...@@ -429,7 +429,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
SELECT COUNT(*) = 0 AS my_value FROM t1; SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value my_value
1 1
...@@ -489,7 +489,7 @@ Table Create Table ...@@ -489,7 +489,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
SELECT COUNT(*) = 0 AS my_value FROM t1; SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value my_value
1 1
...@@ -547,7 +547,7 @@ Table Create Table ...@@ -547,7 +547,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
SELECT COUNT(*) = 0 AS my_value FROM t1; SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value my_value
1 1
...@@ -603,7 +603,7 @@ Table Create Table ...@@ -603,7 +603,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
SELECT COUNT(*) = 0 AS my_value FROM t1; SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value my_value
1 1
...@@ -661,7 +661,7 @@ Table Create Table ...@@ -661,7 +661,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
SELECT COUNT(*) = 0 AS my_value FROM t1; SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value my_value
1 1
...@@ -721,7 +721,7 @@ Table Create Table ...@@ -721,7 +721,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
SELECT COUNT(*) = 0 AS my_value FROM t1; SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value my_value
1 1
...@@ -833,7 +833,7 @@ Table Create Table ...@@ -833,7 +833,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
SELECT COUNT(*) = 0 AS my_value FROM t1; SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value my_value
1 1
...@@ -891,7 +891,7 @@ Table Create Table ...@@ -891,7 +891,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (200) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (2147483647) (SUBPARTITION subpart31 ENGINE = MyISAM, SUBPARTITION subpart32 ENGINE = MyISAM)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (100) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (200) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (2147483647) (SUBPARTITION subpart31 ENGINE = MyISAM, SUBPARTITION subpart32 ENGINE = MyISAM))
SELECT COUNT(*) = 0 AS my_value FROM t1; SELECT COUNT(*) = 0 AS my_value FROM t1;
my_value my_value
1 1
...@@ -1304,7 +1304,7 @@ Table Create Table ...@@ -1304,7 +1304,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
PARTITION BY RANGE(f1) PARTITIONS 2 PARTITION BY RANGE(f1) PARTITIONS 2
...@@ -1319,7 +1319,7 @@ Table Create Table ...@@ -1319,7 +1319,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (f1) SUBPARTITION BY HASH (f1) (PARTITION part1 VALUES LESS THAN (1000) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (2147483647) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM))
DROP TABLE t1; DROP TABLE t1;
# 3.3.2 (positive) number of partition/subpartition , # 3.3.2 (positive) number of partition/subpartition ,
# 0 (= no) named partition/subpartition # 0 (= no) named partition/subpartition
...@@ -1454,7 +1454,7 @@ Table Create Table ...@@ -1454,7 +1454,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION p0 ENGINE = MyISAM, PARTITION part1 ENGINE = MyISAM)
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200; INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200) SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
AS my_value FROM t1; AS my_value FROM t1;
...@@ -1502,7 +1502,7 @@ Table Create Table ...@@ -1502,7 +1502,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM)
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 100 - 1; INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 100 - 1;
ALTER TABLE t1 ADD PARTITION (PARTITION part0); ALTER TABLE t1 ADD PARTITION (PARTITION part0);
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -1510,7 +1510,7 @@ Table Create Table ...@@ -1510,7 +1510,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM)
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200; INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200) SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
AS my_value FROM t1; AS my_value FROM t1;
...@@ -1557,7 +1557,7 @@ Table Create Table ...@@ -1557,7 +1557,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200; INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200) SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
AS my_value FROM t1; AS my_value FROM t1;
...@@ -1603,7 +1603,7 @@ Table Create Table ...@@ -1603,7 +1603,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM, PARTITION part0 ENGINE = MyISAM, PARTITION part2 ENGINE = MyISAM)
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200; INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200) SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
AS my_value FROM t1; AS my_value FROM t1;
...@@ -1651,14 +1651,14 @@ Table Create Table ...@@ -1651,14 +1651,14 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM)
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 100 - 1; INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND 100 - 1;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL, `f1` int(11) DEFAULT NULL,
`f2` char(20) DEFAULT NULL `f2` char(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (f1) (PARTITION part1 ENGINE = MyISAM, PARTITION part3 ENGINE = MyISAM)
INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200; INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 100 AND 200;
SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200) SELECT (COUNT(*) = 200) AND (MIN(f1) = 1) AND (MAX(f1) = 200)
AS my_value FROM t1; AS my_value FROM t1;
......
...@@ -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,
......
...@@ -1036,6 +1036,18 @@ insert into t1 values (1); ...@@ -1036,6 +1036,18 @@ 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 19304 Partitions: MERGE handler not allowed in partitioned tables # BUG 19304 Partitions: MERGE handler not allowed in partitioned tables
# #
......
...@@ -1675,6 +1675,7 @@ static int add_partition_options(File fptr, partition_element *p_elem) ...@@ -1675,6 +1675,7 @@ static int add_partition_options(File fptr, partition_element *p_elem)
{ {
int err= 0; int err= 0;
err+= add_space(fptr);
if (p_elem->tablespace_name) if (p_elem->tablespace_name)
err+= add_keyword_string(fptr,"TABLESPACE", FALSE, err+= add_keyword_string(fptr,"TABLESPACE", FALSE,
p_elem->tablespace_name); p_elem->tablespace_name);
...@@ -1702,7 +1703,7 @@ static int add_partition_values(File fptr, partition_info *part_info, ...@@ -1702,7 +1703,7 @@ static int add_partition_values(File fptr, partition_info *part_info,
if (part_info->part_type == RANGE_PARTITION) if (part_info->part_type == RANGE_PARTITION)
{ {
err+= add_string(fptr, "VALUES LESS THAN "); err+= add_string(fptr, " VALUES LESS THAN ");
if (p_elem->range_value != LONGLONG_MAX) if (p_elem->range_value != LONGLONG_MAX)
{ {
err+= add_begin_parenthesis(fptr); err+= add_begin_parenthesis(fptr);
...@@ -1716,7 +1717,7 @@ static int add_partition_values(File fptr, partition_info *part_info, ...@@ -1716,7 +1717,7 @@ static int add_partition_values(File fptr, partition_info *part_info,
{ {
uint i; uint i;
List_iterator<longlong> list_val_it(p_elem->list_val_list); List_iterator<longlong> list_val_it(p_elem->list_val_list);
err+= add_string(fptr, "VALUES IN "); err+= add_string(fptr, " VALUES IN ");
uint no_items= p_elem->list_val_list.elements; uint no_items= p_elem->list_val_list.elements;
err+= add_begin_parenthesis(fptr); err+= add_begin_parenthesis(fptr);
if (p_elem->has_null_value) if (p_elem->has_null_value)
...@@ -1740,7 +1741,7 @@ static int add_partition_values(File fptr, partition_info *part_info, ...@@ -1740,7 +1741,7 @@ static int add_partition_values(File fptr, partition_info *part_info,
err+= add_end_parenthesis(fptr); err+= add_end_parenthesis(fptr);
} }
end: end:
return err + add_space(fptr); return err;
} }
/* /*
...@@ -1754,6 +1755,7 @@ end: ...@@ -1754,6 +1755,7 @@ end:
buf_length A pointer to the returned buffer length buf_length A pointer to the returned buffer length
use_sql_alloc Allocate buffer from sql_alloc if true use_sql_alloc Allocate buffer from sql_alloc if true
otherwise use my_malloc otherwise use my_malloc
show_partition_options Should we display partition options
RETURN VALUES RETURN VALUES
NULL error NULL error
...@@ -1781,7 +1783,8 @@ end: ...@@ -1781,7 +1783,8 @@ end:
char *generate_partition_syntax(partition_info *part_info, char *generate_partition_syntax(partition_info *part_info,
uint *buf_length, uint *buf_length,
bool use_sql_alloc) bool use_sql_alloc,
bool show_partition_options)
{ {
uint i,j, tot_no_parts, no_subparts, no_parts; uint i,j, tot_no_parts, no_subparts, no_parts;
partition_element *part_elem; partition_element *part_elem;
...@@ -1882,12 +1885,12 @@ char *generate_partition_syntax(partition_info *part_info, ...@@ -1882,12 +1885,12 @@ char *generate_partition_syntax(partition_info *part_info,
first= FALSE; first= FALSE;
err+= add_partition(fptr); err+= add_partition(fptr);
err+= add_name_string(fptr, part_elem->partition_name); err+= add_name_string(fptr, part_elem->partition_name);
err+= add_space(fptr);
err+= add_partition_values(fptr, part_info, part_elem); err+= add_partition_values(fptr, part_info, part_elem);
if (!part_info->is_sub_partitioned() || if (!part_info->is_sub_partitioned() ||
part_info->use_default_subpartitions) part_info->use_default_subpartitions)
{ {
err+= add_partition_options(fptr, part_elem); if (show_partition_options)
err+= add_partition_options(fptr, part_elem);
} }
else else
{ {
...@@ -1900,8 +1903,8 @@ char *generate_partition_syntax(partition_info *part_info, ...@@ -1900,8 +1903,8 @@ char *generate_partition_syntax(partition_info *part_info,
part_elem= sub_it++; part_elem= sub_it++;
err+= add_subpartition(fptr); err+= add_subpartition(fptr);
err+= add_name_string(fptr, part_elem->partition_name); err+= add_name_string(fptr, part_elem->partition_name);
err+= add_space(fptr); if (show_partition_options)
err+= add_partition_options(fptr, part_elem); err+= add_partition_options(fptr, part_elem);
if (j != (no_subparts-1)) if (j != (no_subparts-1))
{ {
err+= add_comma(fptr); err+= add_comma(fptr);
......
...@@ -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