diff options
author | unknown <dlenev@mysql.com> | 2004-10-04 20:13:16 +0400 |
---|---|---|
committer | unknown <dlenev@mysql.com> | 2004-10-04 20:13:16 +0400 |
commit | 5b47c974d86d8db7acdf3b6afa674bf19cbb0c8d (patch) | |
tree | 8debf56a79303c02633b071d1cc0d47bf962e74d /mysql-test | |
parent | ae14bc779e6d3443abd02d386623c47fc8651ebd (diff) | |
parent | 6ed4888cb8a15afad4b0c6aca6ae479d00413678 (diff) | |
download | mariadb-git-5b47c974d86d8db7acdf3b6afa674bf19cbb0c8d.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/dlenev/src/mysql-4.1-ryan
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/type_timestamp.result | 19 | ||||
-rw-r--r-- | mysql-test/t/type_timestamp.test | 15 |
2 files changed, 30 insertions, 4 deletions
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index a823049634f..6a7cecdd460 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -369,7 +369,7 @@ create table t1 (a timestamp null, b timestamp null); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `a` timestamp NULL default NULL, `b` timestamp NULL default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (NULL, NULL); @@ -378,7 +378,22 @@ insert into t1 values (); select * from t1; a b NULL NULL -2001-09-09 04:46:57 NULL +NULL NULL +drop table t1; +create table t1 (a timestamp null default current_timestamp on update current_timestamp, b timestamp null); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `b` timestamp NULL default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (NULL, NULL); +SET TIMESTAMP=1000000018; +insert into t1 values (); +select * from t1; +a b +NULL NULL +2001-09-09 04:46:58 NULL drop table t1; create table t1 (a timestamp null default null, b timestamp null default '2003-01-01 00:00:00'); show create table t1; diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index 7c1258785b0..3f0b41d7221 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -236,9 +236,10 @@ drop table t1; # # Test for TIMESTAMP columns which are able to store NULLs -# (Auto-set property should work for them and NULL values -# should be OK as default values) # + +# Unlike for default TIMESTAMP fields we don't interpret first field +# in this table as TIMESTAMP with DEFAULT NOW() ON UPDATE NOW() properties. create table t1 (a timestamp null, b timestamp null); show create table t1; insert into t1 values (NULL, NULL); @@ -247,6 +248,16 @@ insert into t1 values (); select * from t1; drop table t1; +# But explicit auto-set properties still should be OK. +create table t1 (a timestamp null default current_timestamp on update current_timestamp, b timestamp null); +show create table t1; +insert into t1 values (NULL, NULL); +SET TIMESTAMP=1000000018; +insert into t1 values (); +select * from t1; +drop table t1; + +# It is also OK to specify NULL as default explicitly for such fields. create table t1 (a timestamp null default null, b timestamp null default '2003-01-01 00:00:00'); show create table t1; insert into t1 values (NULL, NULL); |