diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/default.result | 13 | ||||
-rw-r--r-- | mysql-test/r/type_datetime.result | 21 | ||||
-rw-r--r-- | mysql-test/r/type_timestamp.result | 32 | ||||
-rw-r--r-- | mysql-test/t/default.test | 2 | ||||
-rw-r--r-- | mysql-test/t/type_datetime.test | 21 | ||||
-rw-r--r-- | mysql-test/t/type_timestamp.test | 24 |
6 files changed, 100 insertions, 13 deletions
diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result index 03a444e6075..1d64f847995 100644 --- a/mysql-test/r/default.result +++ b/mysql-test/r/default.result @@ -986,14 +986,9 @@ t1 CREATE TABLE `t1` ( `a` decimal(30,6) DEFAULT COALESCE(CURRENT_TIMESTAMP(6)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES(); -Warnings: -Warning 1265 Data truncated for column 'a' at row 1 INSERT IGNORE INTO t1 VALUES(); -Warnings: -Warning 1265 Data truncated for column 'a' at row 1 SET sql_mode = 'STRICT_ALL_TABLES'; INSERT INTO t1 VALUES(); -ERROR 01000: Data truncated for column 'a' at row 1 SET sql_mode = DEFAULT; DROP TABLE t1; # @@ -1006,8 +1001,6 @@ t1 CREATE TABLE `t1` ( `a` decimal(30,6) DEFAULT COALESCE(CURRENT_TIME(6)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES(); -Warnings: -Warning 1265 Data truncated for column 'a' at row 1 DROP TABLE t1; # # DECIMAL + CURRENT_DATE, no truncation @@ -1019,8 +1012,6 @@ t1 CREATE TABLE `t1` ( `a` decimal(30,6) DEFAULT COALESCE(CURRENT_DATE) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES(); -Warnings: -Warning 1265 Data truncated for column 'a' at row 1 DROP TABLE t1; # # COALESCE for SQL Standard <datetime value function> @@ -1077,10 +1068,10 @@ t1 CREATE TABLE `t1` ( INSERT INTO t1 VALUES (); Warnings: Note 1265 Data truncated for column 'a' at row 1 -Warning 1265 Data truncated for column 'b' at row 1 +Note 1265 Data truncated for column 'b' at row 1 SELECT * FROM t1; a b -20010101102030 2001 +20010101102030 20010101102030 DROP TABLE t1; # # Check DEFAULT() function diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 41696aa2d7d..298d0223c69 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -1199,3 +1199,24 @@ DROP TABLE t1; # # End of 10.2 tests # +# +# Start of 10.3 tests +# +# +# MDEV-11331 Wrong result for INSERT INTO t1 (datetime_field) VALUES (hybrid_function_of_TIME_data_type) +# +SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:00:00'); +CREATE TABLE t1 (a DATETIME); +INSERT INTO t1 VALUES (TIME'10:20:30'); +INSERT INTO t1 VALUES (COALESCE(TIME'10:20:30')); +INSERT INTO t1 VALUES (LEAST(TIME'10:20:30',TIME'10:20:30')); +SELECT * FROM t1; +a +2001-02-03 10:20:30 +2001-02-03 10:20:30 +2001-02-03 10:20:30 +DROP TABLE t1; +SET timestamp=DEFAULT; +# +# End of 10.3 tests +# diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index 69c9f68811d..d4afed8d4f8 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -950,3 +950,35 @@ DROP TABLE t1; # # End of 10.1 tests # +# +# Start of 10.3 tests +# +# +# MDEV-11333 MDEV-11333 Expect "Impossible where condition" for WHERE timestamp_field>=DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR) +# +SELECT DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR); +DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR) +NULL +Warnings: +Warning 1441 Datetime function: datetime field overflow +CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, KEY(a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); +INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); +INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); +INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); +INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); +INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); +EXPLAIN SELECT * FROM t1 WHERE a >= DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Warning 1441 Datetime function: datetime field overflow +EXPLAIN SELECT * FROM t1 WHERE a >= COALESCE(DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR)); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +Warnings: +Warning 1441 Datetime function: datetime field overflow +DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test index 5f00debbc3a..746556eac02 100644 --- a/mysql-test/t/default.test +++ b/mysql-test/t/default.test @@ -755,11 +755,9 @@ DROP TABLE t1; CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT COALESCE(CURRENT_TIMESTAMP(6))); SHOW CREATE TABLE t1; -# Same as insert into t1 values ("2016-06-05 12:54:52.342095"); INSERT INTO t1 VALUES(); INSERT IGNORE INTO t1 VALUES(); SET sql_mode = 'STRICT_ALL_TABLES'; ---error WARN_DATA_TRUNCATED INSERT INTO t1 VALUES(); SET sql_mode = DEFAULT; DROP TABLE t1; diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index b16d426ab70..1809f304457 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -751,3 +751,24 @@ DROP TABLE t1; --echo # --echo # End of 10.2 tests --echo # + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-11331 Wrong result for INSERT INTO t1 (datetime_field) VALUES (hybrid_function_of_TIME_data_type) +--echo # +SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:00:00'); +CREATE TABLE t1 (a DATETIME); +INSERT INTO t1 VALUES (TIME'10:20:30'); +INSERT INTO t1 VALUES (COALESCE(TIME'10:20:30')); +INSERT INTO t1 VALUES (LEAST(TIME'10:20:30',TIME'10:20:30')); +SELECT * FROM t1; +DROP TABLE t1; +SET timestamp=DEFAULT; + + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index 460769f8961..2dad92b6b90 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -555,3 +555,27 @@ let defval='0000-00-00 00:00:00'; --echo # --echo # End of 10.1 tests --echo # + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-11333 MDEV-11333 Expect "Impossible where condition" for WHERE timestamp_field>=DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR) +--echo # + +SELECT DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR); +CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, KEY(a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); +INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); +INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); +INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); +INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); +INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03'); +EXPLAIN SELECT * FROM t1 WHERE a >= DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR); +EXPLAIN SELECT * FROM t1 WHERE a >= COALESCE(DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR)); +DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # |