summaryrefslogtreecommitdiff
path: root/mysql-test/t/join_outer.test
diff options
context:
space:
mode:
authorunknown <igor@olga.mysql.com>2007-05-26 10:33:01 -0700
committerunknown <igor@olga.mysql.com>2007-05-26 10:33:01 -0700
commit90484de3f73cb943fd6e31b974e3a13a709dac08 (patch)
tree655d4007369303f7b73299f6a7f43bd363848895 /mysql-test/t/join_outer.test
parenta2051ec57c84b19c6c40f2f53a68afe7d53fc345 (diff)
downloadmariadb-git-90484de3f73cb943fd6e31b974e3a13a709dac08.tar.gz
Fixed bug #28571. Outer join queries with ON conditions over
constant outer tables did not return null complemented rows when conditions were evaluated to FALSE. Wrong results were returned because the conditions over constant outer tables, when being pushed down, were erroneously enclosed into the guard function used for WHERE conditions. mysql-test/r/join_outer.result: Added a test case for bug #28571. mysql-test/t/join_outer.test: Added a test case for bug #28571. sql/sql_select.cc: Fixed bug #28571. Outer join queries with ON conditions over constant outer tables did not return null complemented rows when conditions were evaluated to FALSE. Wrong results were returned because the conditions over constant outer tables, when being pushed down, were erroneously enclosed into the guard function used for WHERE conditions. The problem is fixed in the function make_join_select. Now the conditions over constant tables from ON expressions are pushed down after the conditions from WHERE has been pushed down.
Diffstat (limited to 'mysql-test/t/join_outer.test')
-rw-r--r--mysql-test/t/join_outer.test16
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index 51e79a20d65..1a59dbf8fc2 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -845,3 +845,19 @@ SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL;
show status like 'Handler_read%';
DROP TABLE t1,t2;
+
+#
+# Bug 28571: outer join with false on condition over constant tables
+#
+
+CREATE TABLE t1 (c int PRIMARY KEY, e int NOT NULL);
+INSERT INTO t1 VALUES (1,0), (2,1);
+CREATE TABLE t2 (d int PRIMARY KEY);
+INSERT INTO t2 VALUES (1), (2), (3);
+
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL;
+SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL;
+SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d<=>NULL;
+
+DROP TABLE t1,t2;
+