summaryrefslogtreecommitdiff
path: root/mysql-test/t/group_min_max.test
diff options
context:
space:
mode:
authorMartin Hansson <martin.hansson@sun.com>2010-03-16 15:51:00 +0100
committerMartin Hansson <martin.hansson@sun.com>2010-03-16 15:51:00 +0100
commit7dc693229fc90dbd9c7744435483cbe1a0767c56 (patch)
treedfcecf32de24bf295b996a6041a1d446bec24d60 /mysql-test/t/group_min_max.test
parent9fc32c2e2441d254ec21d5b0541e468f9d9dd149 (diff)
downloadmariadb-git-7dc693229fc90dbd9c7744435483cbe1a0767c56.tar.gz
Bug#47762: Incorrect result from MIN() when WHERE tests NOT
NULL column for NULL The optimization to read MIN() and MAX() values from an index did not properly handle comparisons with NULL values. Fixed by giving up the particular optimization step if there are non-NULL safe comparisons with NULL values, as the result is NULL anyway. Also, Oracle copyright notice was added to all files.
Diffstat (limited to 'mysql-test/t/group_min_max.test')
-rw-r--r--mysql-test/t/group_min_max.test19
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index df385dfa7d2..6aec0e3677f 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -1054,4 +1054,23 @@ SELECT 1 AS c, b FROM t1 WHERE b IN (1,2) GROUP BY c, b;
SELECT a FROM t1 WHERE b=1;
DROP TABLE t1;
+--echo #
+--echo # Bug#47762: Incorrect result from MIN() when WHERE tests NOT NULL column
+--echo # for NULL
+--echo #
+
+--echo ## Test for NULLs allowed
+CREATE TABLE t1 ( a INT, KEY (a) );
+INSERT INTO t1 VALUES (1), (2), (3);
+--source include/min_null_cond.inc
+INSERT INTO t1 VALUES (NULL), (NULL);
+--source include/min_null_cond.inc
+DROP TABLE t1;
+
+--echo ## Test for NOT NULLs
+CREATE TABLE t1 ( a INT NOT NULL PRIMARY KEY);
+INSERT INTO t1 VALUES (1), (2), (3);
+--source include/min_null_cond.inc
+DROP TABLE t1;
+
--echo End of 5.1 tests