diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index d7ad803b828..adc22cd1ac2 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -1235,3 +1235,13 @@ create table t1(a varchar(65537)); ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead create table t1(a varbinary(65537)); ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead +set @@sql_mode='traditional'; +create table t1(a int, b date not null); +alter table t1 modify a bigint unsigned not null; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned NOT NULL, + `b` date NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index 302acc9bef2..6ac88e4d629 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -1093,3 +1093,13 @@ set @@sql_mode='traditional'; create table t1(a varchar(65537)); --error 1074 create table t1(a varbinary(65537)); + +# +# Bug #9881: problem with altering table +# + +set @@sql_mode='traditional'; +create table t1(a int, b date not null); +alter table t1 modify a bigint unsigned not null; +show create table t1; +drop table t1; diff --git a/sql/field.cc b/sql/field.cc index bb035ce5d37..71e90fb5bdf 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -8487,7 +8487,8 @@ create_field::create_field(Field *old_field,Field *orig_field) else interval=0; def=0; - if (!old_field->is_real_null() && ! (flags & BLOB_FLAG) && + if (!(flags & NO_DEFAULT_VALUE_FLAG) && + !old_field->is_real_null() && ! (flags & BLOB_FLAG) && old_field->ptr && orig_field) { char buff[MAX_FIELD_WIDTH],*pos;