diff options
Diffstat (limited to 'mysql-test/t/group_by.test')
-rw-r--r-- | mysql-test/t/group_by.test | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index f90c1dc3c58..f46a20b2db4 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1224,3 +1224,26 @@ DROP TABLE t1, t2; --echo # --echo # End of 5.1 tests + +--echo # +--echo # Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00 +--echo # +CREATE TABLE t1 (f1 int, f2 DATE); + +INSERT INTO t1 VALUES (1,'2004-04-19'), (1,'0000-00-00'), (1,'2004-04-18'), +(2,'2004-05-19'), (2,'0001-01-01'), (3,'2004-04-10'); + +SELECT MIN(f2),MAX(f2) FROM t1; +SELECT f1,MIN(f2),MAX(f2) FROM t1 GROUP BY 1; + +DROP TABLE t1; + +CREATE TABLE t1 ( f1 int, f2 time); +INSERT INTO t1 VALUES (1,'01:27:35'), (1,'06:11:01'), (2,'19:53:05'), +(2,'21:44:25'), (3,'10:55:12'), (3,'05:45:11'), (4,'00:25:00'); + +SELECT MIN(f2),MAX(f2) FROM t1; +SELECT f1,MIN(f2),MAX(f2) FROM t1 GROUP BY 1; + +DROP TABLE t1; +--echo #End of test#49771 |