summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <ramil@mysql.com>2005-07-15 15:50:57 +0500
committerunknown <ramil@mysql.com>2005-07-15 15:50:57 +0500
commitf4cd03d03f81e2cfd986e8b96af6f3b46b87ec45 (patch)
tree0742313cc8d9c5aec62e73e6f01b1e2726905bc1
parent908ff34e0464cf25295fc461602856da8d80ac02 (diff)
downloadmariadb-git-f4cd03d03f81e2cfd986e8b96af6f3b46b87ec45.tar.gz
a fix (bug #9881: ALTER TABLE gives wrong error message with sql-mode TRADITIONAL).
sql/field.cc: a fix (bug #9881: ALTER TABLE gives wrong error message with sql-mode TRADITIONAL). Don't set def if NO_DEFAULT_VALUE_FLAG is set.
-rw-r--r--mysql-test/r/strict.result10
-rw-r--r--mysql-test/t/strict.test10
-rw-r--r--sql/field.cc3
3 files changed, 22 insertions, 1 deletions
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;