summaryrefslogtreecommitdiff
path: root/mysql-test/t/alter_table.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/alter_table.test')
-rw-r--r--mysql-test/t/alter_table.test29
1 files changed, 28 insertions, 1 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 38d0d08808a..15b037a0294 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -121,11 +121,15 @@ alter table t1 disable keys;
show keys from t1;
#let $1=10000;
let $1=10;
+--disable_query_log
+begin;
while ($1)
{
eval insert into t1 values($1,RAND()*1000,RAND()*1000,RAND());
dec $1;
}
+commit;
+--enable_query_log
alter table t1 enable keys;
show keys from t1;
drop table t1;
@@ -144,11 +148,15 @@ drop table t1;
create table t1 (a int, b int);
let $1=100;
+--disable_query_log
+begin;
while ($1)
{
eval insert into t1 values(1,$1), (2,$1), (3, $1);
dec $1;
}
+commit;
+--enable_query_log
alter table t1 add unique (a,b), add key (b);
show keys from t1;
analyze table t1;
@@ -159,7 +167,7 @@ drop table t1;
# Test of ALTER TABLE DELAYED
#
-CREATE TABLE t1 (i int(10), index(i) );
+CREATE TABLE t1 (i int(10), index(i) ) ENGINE=MyISAM;
ALTER TABLE t1 DISABLE KEYS;
INSERT DELAYED INTO t1 VALUES(1),(2),(3);
ALTER TABLE t1 ENABLE KEYS;
@@ -966,12 +974,14 @@ DROP TABLE t1;
create table t1(f1 int not null, f2 int not null, key (f1), key (f2));
let $count= 50;
--disable_query_log
+begin;
while ($count)
{
EVAL insert into t1 values (1,1),(1,1),(1,1),(1,1),(1,1);
EVAL insert into t1 values (2,2),(2,2),(2,2),(2,2),(2,2);
dec $count ;
}
+commit;
--enable_query_log
select index_length into @unpaked_keys_size from
@@ -1000,6 +1010,23 @@ ALTER TABLE t1 MODIFY b ENUM('a', 'z', 'b', 'c') NOT NULL;
SELECT * FROM t1;
DROP TABLE t1;
+#
+# Test for ALTER column DROP DEFAULT
+#
+
+SET @save_sql_mode=@@sql_mode;
+SET sql_mode=strict_all_tables;
+
+CREATE TABLE t1 (a int NOT NULL default 42);
+INSERT INTO t1 values ();
+SELECT * FROM t1;
+ALTER TABLE t1 ALTER COLUMN a DROP DEFAULT;
+--error 1364
+INSERT INTO t1 values ();
+INSERT INTO t1 (a) VALUES (11);
+SELECT * FROM t1 ORDER BY a;
+DROP TABLE t1;
+SET @@sql_mode=@save_sql_mode;
--echo #
--echo # Bug#45567: Fast ALTER TABLE broken for enum and set
--echo #