Commit 6d16282f authored by unknown's avatar unknown
Browse files

Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-5.1

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

parents 09617144 1dd45d5c
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
drop table if exists t1;
create table t1 (a int)
engine = x
partition by key (a);
Warnings:
Error	1286	Unknown table engine 'x'
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) 
drop table t1;
create table t1 (a int)
engine = innodb
partition by list (a)
(partition p0 values in (0));
alter table t1 engine = x;
Warnings:
Error	1286	Unknown table engine 'x'
show create table t1;
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)
drop table t1;
partition by list (a)
partitions 3
(partition x1 values in (1,2,9,4) tablespace ts1,
+20 −0
Original line number Diff line number Diff line
@@ -8,6 +8,24 @@
drop table if exists t1;
--enable_warnings

#
# Bug 20397: Partitions: Crash when using non-existing engine
#
create table t1 (a int)
engine = x
partition by key (a);
show create table t1;
drop table t1;

create table t1 (a int)
engine = innodb
partition by list (a)
(partition p0 values in (0));

alter table t1 engine = x;
show create table t1;
drop table t1;

#
# Partition by key stand-alone error
#
@@ -779,3 +797,5 @@ partition by range (a + (select count(*) from t1))
-- error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
create table t1 (a char(10))
partition by hash (extractvalue(a,'a'));

+16 −1
Original line number Diff line number Diff line
@@ -5008,7 +5008,22 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,

  old_db_type= table->s->db_type;
  if (!create_info->db_type)
  {
    if (table->part_info &&
        create_info->used_fields & HA_CREATE_USED_ENGINE)
    {
      /*
        This case happens when the user specified
        ENGINE = x where x is a non-existing storage engine
        We set create_info->db_type to default_engine_type
        to ensure we don't change underlying engine type
        due to a erroneously given engine name.
      */
      create_info->db_type= table->part_info->default_engine_type;
    }
    else
      create_info->db_type= old_db_type;
  }

#ifdef WITH_PARTITION_STORAGE_ENGINE
  if (prep_alter_part_table(thd, table, alter_info, create_info, old_db_type,