summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <ramil@mysql.com>2005-07-25 14:36:07 +0500
committerunknown <ramil@mysql.com>2005-07-25 14:36:07 +0500
commit17132a93f2bde74f625e860daee655d99c8e81a7 (patch)
treeb350d603071f3551d9f6e63df354fa564a5ecc81 /mysql-test
parent0eea2a124bd5c8269a5382da9ac82526a5e2f384 (diff)
downloadmariadb-git-17132a93f2bde74f625e860daee655d99c8e81a7.tar.gz
fix (bug #11964: ALTER TABLE gives wrong error message with sql-mode TRADITIONAL (timestamp)).
sql/field.cc: fix (bug #11964: ALTER TABLE gives wrong error message with sql-mode TRADITIONAL (timestamp)). set def only if timestamp fields have explicit default value.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/strict.result21
-rw-r--r--mysql-test/t/strict.test14
2 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result
index 49f118b1d96..6239d4a4012 100644
--- a/mysql-test/r/strict.result
+++ b/mysql-test/r/strict.result
@@ -1258,3 +1258,24 @@ select * from t1;
d
2000-10-01
drop table t1;
+set @@sql_mode='traditional';
+create table t1(a int, b timestamp);
+alter table t1 add primary key(a);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL default '0',
+ `b` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1(a int, b timestamp default 20050102030405);
+alter table t1 add primary key(a);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL default '0',
+ `b` timestamp NOT NULL default '2005-01-02 03:04:05',
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test
index 71b57424e75..ffe2e4e261e 100644
--- a/mysql-test/t/strict.test
+++ b/mysql-test/t/strict.test
@@ -1118,3 +1118,17 @@ insert into t1 values ('2000-10-01');
update t1 set d = 1100;
select * from t1;
drop table t1;
+
+#
+# Bug #11964: alter table with timestamp field
+#
+
+set @@sql_mode='traditional';
+create table t1(a int, b timestamp);
+alter table t1 add primary key(a);
+show create table t1;
+drop table t1;
+create table t1(a int, b timestamp default 20050102030405);
+alter table t1 add primary key(a);
+show create table t1;
+drop table t1;