Commit 508336fe authored by unknown's avatar unknown

Merge c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/bug19140

into  c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/bug19010


mysql-test/t/partition.test:
  Auto merged
sql/sql_partition.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
mysql-test/r/ndb_partition_key.result:
  manual merge
mysql-test/r/partition.result:
  manual merge
mysql-test/t/ndb_partition_key.test:
  manual merge
parents bff93cbe 841abbcc
......@@ -234,3 +234,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 3
drop table t1;
CREATE TABLE t1 (a int)
PARTITION BY KEY(a)
(PARTITION p0 ENGINE = NDB);
DROP TABLE t1;
......@@ -913,4 +913,9 @@ CREATE TABLE t1 (a int, index(a)) PARTITION BY KEY(a);
ALTER TABLE t1 DISABLE KEYS;
ALTER TABLE t1 ENABLE KEYS;
DROP TABLE t1;
create table t1 (a int) engine=memory
partition by key(a);
insert into t1 values (1);
create index inx1 on t1(a);
drop table t1;
End of 5.1 tests
......@@ -216,3 +216,9 @@ alter table t1 add partition partitions 1;
show create table t1;
drop table t1;
CREATE TABLE t1 (a int)
PARTITION BY KEY(a)
(PARTITION p0 ENGINE = NDB);
DROP TABLE t1;
......@@ -9,6 +9,11 @@
drop table if exists t1;
--enable_warnings
create table t1 (a int)
partition by key(a)
(partition p0 engine = MEMORY);
drop table t1;
#
# Partition by key no partition defined => OK
#
......@@ -1009,6 +1014,15 @@ select auto_increment from information_schema.tables where table_name='t1';
select * from t1;
drop table t1;
#
# BUG 19140 Partitions: Create index for partitioned table crashes
#
create table t1 (a int) engine=memory
partition by key(a);
insert into t1 values (1);
create index inx1 on t1(a);
drop table t1;
#
# BUG 19062 Partition clause ignored if CREATE TABLE ... AS SELECT ...;
#
......
......@@ -4518,7 +4518,7 @@ the generated partition syntax in a correct manner.
if (alter_info->flags & ALTER_REMOVE_PARTITIONING)
{
DBUG_PRINT("info", ("Remove partitioning"));
if (!(thd->lex->create_info.used_fields & HA_CREATE_USED_ENGINE))
if (!(create_info->used_fields & HA_CREATE_USED_ENGINE))
{
DBUG_PRINT("info", ("No explicit engine used"));
create_info->db_type= table->part_info->default_engine_type;
......@@ -4535,7 +4535,7 @@ the generated partition syntax in a correct manner.
beneath.
*/
thd->work_part_info= table->part_info;
if (thd->lex->create_info.used_fields & HA_CREATE_USED_ENGINE &&
if (create_info->used_fields & HA_CREATE_USED_ENGINE &&
create_info->db_type != table->part_info->default_engine_type)
{
/*
......
......@@ -3139,7 +3139,7 @@ bool mysql_create_table_internal(THD *thd,
}
DBUG_PRINT("info", ("db_type = %d",
ha_legacy_type(part_info->default_engine_type)));
if (part_info->check_partition_info( &engine_type, file,
if (part_info->check_partition_info(&engine_type, file,
create_info->max_rows))
goto err;
part_info->default_engine_type= engine_type;
......@@ -3199,6 +3199,12 @@ bool mysql_create_table_internal(THD *thd,
}
else if (create_info->db_type != engine_type)
{
/*
We come here when we don't use a partitioned handler.
Since we use a partitioned table it must be "native partitioned".
We have switched engine from defaults, most likely only specified
engines in partition clauses.
*/
delete file;
if (!(file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root, engine_type)))
{
......
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