summaryrefslogtreecommitdiff
path: root/mysql-test/t/type_datetime.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/type_datetime.test')
-rw-r--r--mysql-test/t/type_datetime.test51
1 files changed, 51 insertions, 0 deletions
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index 6e40c9ccfa0..81e032751ca 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -445,6 +445,17 @@ SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS
# show we truncate microseconds from the right
SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7));
+--echo #
+--echo # Bug#59173: Failure to handle DATE(TIME) values where Year, Month or
+--echo # Day is ZERO
+--echo #
+CREATE TABLE t1 (dt1 DATETIME);
+INSERT INTO t1 (dt1) VALUES ('0000-00-01 00:00:01');
+DELETE FROM t1 WHERE dt1 = '0000-00-01 00:00:01';
+--echo # Should be empty
+SELECT * FROM t1;
+DROP TABLE t1;
+
--echo End of 5.1 tests
--echo #
@@ -485,5 +496,45 @@ explain select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y');
DROP TABLE t1,t2;
--echo #
+--echo # Bug#57095: Wrongly chosen expression cache type led to a wrong
+--echo # result.
+--echo #
+CREATE TABLE t1 (`b` datetime );
+INSERT INTO t1 VALUES ('2010-01-01 00:00:00'), ('2010-01-01 00:00:00');
+SELECT * FROM t1 WHERE b <= coalesce(NULL, now());
+DROP TABLE t1;
+--echo #
+
+--echo #
+--echo # BUG#12561818: RERUN OF STORED FUNCTION GIVES ERROR 1172:
+--echo # RESULT CONSISTED OF MORE THAN ONE ROW
+--echo #
+
+CREATE TABLE t1 (a DATE NOT NULL, b INT);
+INSERT INTO t1 VALUES ('0000-00-00',1), ('1999-05-10',2);
+
+CREATE TABLE t2 (a DATETIME NOT NULL, b INT);
+INSERT INTO t2 VALUES ('0000-00-00 00:00:00',1), ('1999-05-10 00:00:00',2);
+
+--echo
+SELECT * FROM t1 WHERE a IS NULL;
+SELECT * FROM t2 WHERE a IS NULL;
+SELECT * FROM t1 LEFT JOIN t1 AS t1_2 ON 1 WHERE t1_2.a IS NULL;
+SELECT * FROM t2 LEFT JOIN t2 AS t2_2 ON 1 WHERE t2_2.a IS NULL;
+SELECT * FROM t1 JOIN t1 AS t1_2 ON 1 WHERE t1_2.a IS NULL;
+SELECT * FROM t2 JOIN t2 AS t2_2 ON 1 WHERE t2_2.a IS NULL;
+
+--echo
+PREPARE stmt1 FROM
+ 'SELECT *
+ FROM t1 LEFT JOIN t1 AS t1_2 ON 1
+ WHERE t1_2.a IS NULL AND t1_2.b < 2';
+EXECUTE stmt1;
+EXECUTE stmt1;
+
+DEALLOCATE PREPARE stmt1;
+DROP TABLE t1,t2;
+
+--echo #
--echo # End of 5.5 tests
--echo #