diff options
author | Alexander Barkov <bar@mariadb.org> | 2015-09-22 14:01:54 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2015-09-22 14:01:54 +0400 |
commit | 5c9c8ef1eac0a3868a57ed8fda8bda8cd2453b37 (patch) | |
tree | 88739fffdf78de796c665affa6beb8687ca25a2b /storage/tokudb | |
parent | 89af0f11a83188cb2bfbfed0b54c00d718734995 (diff) | |
download | mariadb-git-5c9c8ef1eac0a3868a57ed8fda8bda8cd2453b37.tar.gz |
MDEV-3929 Add system variable explicit_defaults_for_timestamp for compatibility with MySQL
Diffstat (limited to 'storage/tokudb')
4 files changed, 20 insertions, 20 deletions
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_datetime.result b/storage/tokudb/mysql-test/tokudb/r/type_datetime.result index 77364b90f9d..678be1655e4 100644 --- a/storage/tokudb/mysql-test/tokudb/r/type_datetime.result +++ b/storage/tokudb/mysql-test/tokudb/r/type_datetime.result @@ -59,7 +59,7 @@ select * from t1; t 0000-00-00 00:00:00 drop table t1; -CREATE TABLE t1 (a timestamp, b date, c time, d datetime); +CREATE TABLE t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, b date, c time, d datetime); insert into t1 (b,c,d) values(now(),curtime(),now()); Warnings: Note 1265 Data truncated for column 'b' at row 1 diff --git a/storage/tokudb/mysql-test/tokudb/r/type_timestamp.result b/storage/tokudb/mysql-test/tokudb/r/type_timestamp.result index 9154c84d5a7..c412620173c 100644 --- a/storage/tokudb/mysql-test/tokudb/r/type_timestamp.result +++ b/storage/tokudb/mysql-test/tokudb/r/type_timestamp.result @@ -1,7 +1,7 @@ SET DEFAULT_STORAGE_ENGINE='tokudb'; drop table if exists t1,t2; set time_zone="+03:00"; -CREATE TABLE t1 (a int, t timestamp); +CREATE TABLE t1 (a int, t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP); CREATE TABLE t2 (a int, t datetime); SET TIMESTAMP=1234; insert into t1 values(1,NULL); @@ -178,7 +178,7 @@ create table t1 (t1 timestamp default now(), t2 timestamp on update now()); drop table t1; create table t1 (t1 timestamp on update now(), t2 timestamp default now() on update now()); drop table t1; -create table t1 (t1 timestamp default '2003-01-01 00:00:00', t2 datetime, t3 timestamp); +create table t1 (t1 timestamp NOT NULL DEFAULT '2003-01-01 00:00:00', t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'); SET TIMESTAMP=1000000000; insert into t1 values (); SET TIMESTAMP=1000000001; @@ -202,7 +202,7 @@ t1 timestamp NO 2003-01-01 00:00:00 t2 datetime YES NULL t3 timestamp NO 0000-00-00 00:00:00 drop table t1; -create table t1 (t1 timestamp default now(), t2 datetime, t3 timestamp); +create table t1 (t1 timestamp NOT NULL DEFAULT now(), t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'); SET TIMESTAMP=1000000002; insert into t1 values (); SET TIMESTAMP=1000000003; @@ -226,7 +226,7 @@ t1 timestamp NO CURRENT_TIMESTAMP t2 datetime YES NULL t3 timestamp NO 0000-00-00 00:00:00 drop table t1; -create table t1 (t1 timestamp default '2003-01-01 00:00:00' on update now(), t2 datetime); +create table t1 (t1 timestamp NOT NULL DEFAULT '2003-01-01 00:00:00' on update now(), t2 datetime); SET TIMESTAMP=1000000004; insert into t1 values (); select * from t1; @@ -251,7 +251,7 @@ Field Type Null Key Default Extra t1 timestamp NO 2003-01-01 00:00:00 on update CURRENT_TIMESTAMP t2 datetime YES NULL drop table t1; -create table t1 (t1 timestamp default now() on update now(), t2 datetime); +create table t1 (t1 timestamp NOT NULL DEFAULT now() on update now(), t2 datetime); SET TIMESTAMP=1000000006; insert into t1 values (); select * from t1; @@ -276,7 +276,7 @@ Field Type Null Key Default Extra t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP t2 datetime YES NULL drop table t1; -create table t1 (t1 timestamp, t2 datetime, t3 timestamp); +create table t1 (t1 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'); SET TIMESTAMP=1000000007; insert into t1 values (); select * from t1; @@ -303,7 +303,7 @@ t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP t2 datetime YES NULL t3 timestamp NO 0000-00-00 00:00:00 drop table t1; -create table t1 (t1 timestamp default current_timestamp on update current_timestamp, t2 datetime); +create table t1 (t1 timestamp NOT NULL DEFAULT current_timestamp on update current_timestamp, t2 datetime); SET TIMESTAMP=1000000009; insert into t1 values (); select * from t1; @@ -418,7 +418,7 @@ drop table t1; create table t1 (a bigint, b bigint); insert into t1 values (NULL, NULL), (20030101000000, 20030102000000); set timestamp=1000000019; -alter table t1 modify a timestamp, modify b timestamp; +alter table t1 modify a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, modify b timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP; select * from t1; a b 2001-09-09 04:46:59 2001-09-09 04:46:59 @@ -442,7 +442,7 @@ t1 CREATE TABLE "t1" ( ) set sql_mode=''; drop table t1; -create table t1 (a int auto_increment primary key, b int, c timestamp); +create table t1 (a int auto_increment primary key, b int, c timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 (a, b, c) values (1, 0, '2001-01-01 01:01:01'), (2, 0, '2002-02-02 02:02:02'), (3, 0, '2003-03-03 03:03:03'); select * from t1; diff --git a/storage/tokudb/mysql-test/tokudb/t/type_datetime.test b/storage/tokudb/mysql-test/tokudb/t/type_datetime.test index 0dd489e3d5c..1a6b2ed7142 100644 --- a/storage/tokudb/mysql-test/tokudb/t/type_datetime.test +++ b/storage/tokudb/mysql-test/tokudb/t/type_datetime.test @@ -33,7 +33,7 @@ drop table t1; # Test insert of now() and curtime() # -CREATE TABLE t1 (a timestamp, b date, c time, d datetime); +CREATE TABLE t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, b date, c time, d datetime); insert into t1 (b,c,d) values(now(),curtime(),now()); select date_format(a,"%Y-%m-%d")=b,right(a+0,6)=c+0,a=d+0 from t1; drop table t1; diff --git a/storage/tokudb/mysql-test/tokudb/t/type_timestamp.test b/storage/tokudb/mysql-test/tokudb/t/type_timestamp.test index 99d759d64bc..031825cfbff 100644 --- a/storage/tokudb/mysql-test/tokudb/t/type_timestamp.test +++ b/storage/tokudb/mysql-test/tokudb/t/type_timestamp.test @@ -10,7 +10,7 @@ drop table if exists t1,t2; # Set timezone to GMT-3, to make it possible to use "interval 3 hour" set time_zone="+03:00"; -CREATE TABLE t1 (a int, t timestamp); +CREATE TABLE t1 (a int, t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP); CREATE TABLE t2 (a int, t datetime); SET TIMESTAMP=1234; insert into t1 values(1,NULL); @@ -116,7 +116,7 @@ drop table t1; # Let us test TIMESTAMP auto-update behaviour # Also we will test behaviour of TIMESTAMP field in SHOW CREATE TABLE and # behaviour of DEFAULT literal for such fields -create table t1 (t1 timestamp default '2003-01-01 00:00:00', t2 datetime, t3 timestamp); +create table t1 (t1 timestamp NOT NULL DEFAULT '2003-01-01 00:00:00', t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'); SET TIMESTAMP=1000000000; insert into t1 values (); SET TIMESTAMP=1000000001; @@ -128,7 +128,7 @@ show create table t1; show columns from t1; drop table t1; -create table t1 (t1 timestamp default now(), t2 datetime, t3 timestamp); +create table t1 (t1 timestamp NOT NULL DEFAULT now(), t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'); SET TIMESTAMP=1000000002; insert into t1 values (); SET TIMESTAMP=1000000003; @@ -140,7 +140,7 @@ show create table t1; show columns from t1; drop table t1; -create table t1 (t1 timestamp default '2003-01-01 00:00:00' on update now(), t2 datetime); +create table t1 (t1 timestamp NOT NULL DEFAULT '2003-01-01 00:00:00' on update now(), t2 datetime); SET TIMESTAMP=1000000004; insert into t1 values (); select * from t1; @@ -153,7 +153,7 @@ show create table t1; show columns from t1; drop table t1; -create table t1 (t1 timestamp default now() on update now(), t2 datetime); +create table t1 (t1 timestamp NOT NULL DEFAULT now() on update now(), t2 datetime); SET TIMESTAMP=1000000006; insert into t1 values (); select * from t1; @@ -166,7 +166,7 @@ show create table t1; show columns from t1; drop table t1; -create table t1 (t1 timestamp, t2 datetime, t3 timestamp); +create table t1 (t1 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'); SET TIMESTAMP=1000000007; insert into t1 values (); select * from t1; @@ -182,7 +182,7 @@ drop table t1; # Let us test if CURRENT_TIMESTAMP also works well as default value # (Of course NOW and CURRENT_TIMESTAMP are same for parser but still just # for demonstartion.) -create table t1 (t1 timestamp default current_timestamp on update current_timestamp, t2 datetime); +create table t1 (t1 timestamp NOT NULL DEFAULT current_timestamp on update current_timestamp, t2 datetime); SET TIMESTAMP=1000000009; insert into t1 values (); select * from t1; @@ -282,7 +282,7 @@ drop table t1; create table t1 (a bigint, b bigint); insert into t1 values (NULL, NULL), (20030101000000, 20030102000000); set timestamp=1000000019; -alter table t1 modify a timestamp, modify b timestamp; +alter table t1 modify a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, modify b timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP; select * from t1; drop table t1; @@ -311,7 +311,7 @@ drop table t1; # # Bug#7806 - insert on duplicate key and auto-update of timestamp # -create table t1 (a int auto_increment primary key, b int, c timestamp); +create table t1 (a int auto_increment primary key, b int, c timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1 (a, b, c) values (1, 0, '2001-01-01 01:01:01'), (2, 0, '2002-02-02 02:02:02'), (3, 0, '2003-03-03 03:03:03'); select * from t1; |