Browse Source

#175 test case for alter table modify enum

pull/73/head
Rich Prohaska 12 years ago
parent
commit
88f846d676
  1. 57
      mysql-test/suite/tokudb.alter_table/r/mod_enum.result
  2. 51
      mysql-test/suite/tokudb.alter_table/t/mod_enum.test

57
mysql-test/suite/tokudb.alter_table/r/mod_enum.result

@ -0,0 +1,57 @@
set default_storage_engine=tokudb;
drop table if exists test_enum;
CREATE TABLE test_enum (col1 INT NOT NULL PRIMARY KEY AUTO_INCREMENT, col2 ENUM('value1','value2','value3') NULL);
INSERT INTO test_enum (col2) VALUES ('value1'),('value1'),('value3');
SELECT * FROM test_enum;
col1 col2
1 value1
2 value1
3 value3
set tokudb_disable_slow_alter=1;
ALTER TABLE test_enum MODIFY COLUMN col2 ENUM('value1','value2','value3');
SELECT * FROM test_enum;
col1 col2
1 value1
2 value1
3 value3
drop table test_enum;
CREATE TABLE test_enum (col1 INT NOT NULL PRIMARY KEY AUTO_INCREMENT, col2 ENUM('value1','value2','value3') NULL);
INSERT INTO test_enum (col2) VALUES ('value1'),('value1'),('value3');
SELECT * FROM test_enum;
col1 col2
1 value1
2 value1
3 value3
set tokudb_disable_slow_alter=1;
ALTER TABLE test_enum MODIFY COLUMN col2 ENUM('value1','value3');
ERROR 42000: Table 'test_enum' uses an extension that doesn't exist in this MySQL version
set tokudb_disable_hot_alter=1;
set tokudb_disable_slow_alter=0;
ALTER TABLE test_enum MODIFY COLUMN col2 ENUM('value1','value3');
SELECT * FROM test_enum;
col1 col2
1 value1
2 value1
3 value3
drop table test_enum;
CREATE TABLE test_enum (col1 INT NOT NULL PRIMARY KEY AUTO_INCREMENT, col2 ENUM('value1','value2','value3') NULL);
INSERT INTO test_enum (col2) VALUES ('value1'),('value1'),('value3');
SELECT * FROM test_enum;
col1 col2
1 value1
2 value1
3 value3
set tokudb_disable_slow_alter=1;
ALTER TABLE test_enum MODIFY COLUMN col2 ENUM('value1','value2','value4');
ERROR 42000: Table 'test_enum' uses an extension that doesn't exist in this MySQL version
set tokudb_disable_hot_alter=1;
set tokudb_disable_slow_alter=0;
ALTER TABLE test_enum MODIFY COLUMN col2 ENUM('value1','value2','value4');
Warnings:
Warning 1265 Data truncated for column 'col2' at row 3
SELECT * FROM test_enum;
col1 col2
1 value1
2 value1
3
drop table test_enum;

51
mysql-test/suite/tokudb.alter_table/t/mod_enum.test

@ -0,0 +1,51 @@
# test for bogus inplace alter of an enum field
source include/have_tokudb.inc;
set default_storage_engine=tokudb;
disable_warnings;
drop table if exists test_enum;
enable_warnings;
# no change in enum list
CREATE TABLE test_enum (col1 INT NOT NULL PRIMARY KEY AUTO_INCREMENT, col2 ENUM('value1','value2','value3') NULL);
INSERT INTO test_enum (col2) VALUES ('value1'),('value1'),('value3');
SELECT * FROM test_enum;
set tokudb_disable_slow_alter=1;
ALTER TABLE test_enum MODIFY COLUMN col2 ENUM('value1','value2','value3');
SELECT * FROM test_enum;
drop table test_enum;
# change number in enum list
CREATE TABLE test_enum (col1 INT NOT NULL PRIMARY KEY AUTO_INCREMENT, col2 ENUM('value1','value2','value3') NULL);
INSERT INTO test_enum (col2) VALUES ('value1'),('value1'),('value3');
SELECT * FROM test_enum;
set tokudb_disable_slow_alter=1;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE test_enum MODIFY COLUMN col2 ENUM('value1','value3');
set tokudb_disable_hot_alter=1;
set tokudb_disable_slow_alter=0;
ALTER TABLE test_enum MODIFY COLUMN col2 ENUM('value1','value3');
SELECT * FROM test_enum;
drop table test_enum;
# change values in enum list
CREATE TABLE test_enum (col1 INT NOT NULL PRIMARY KEY AUTO_INCREMENT, col2 ENUM('value1','value2','value3') NULL);
INSERT INTO test_enum (col2) VALUES ('value1'),('value1'),('value3');
SELECT * FROM test_enum;
set tokudb_disable_slow_alter=1;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE test_enum MODIFY COLUMN col2 ENUM('value1','value2','value4');
set tokudb_disable_hot_alter=1;
set tokudb_disable_slow_alter=0;
ALTER TABLE test_enum MODIFY COLUMN col2 ENUM('value1','value2','value4');
SELECT * FROM test_enum;
drop table test_enum;
Loading…
Cancel
Save