summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorevgen@moonbone.local <>2005-07-16 03:29:12 +0400
committerevgen@moonbone.local <>2005-07-16 03:29:12 +0400
commit0298bc347aad0ad0ed0083781d84d412a921459d (patch)
tree64606741d37005b7ae298d28019e32fa16916379 /mysql-test
parentb144b920a0b40dbb56e104b51eb4a8e39461db9a (diff)
downloadmariadb-git-0298bc347aad0ad0ed0083781d84d412a921459d.tar.gz
Fix bug#11482 4.1.12 produces different resultset for a complex query
than in previous 4.1.x Wrongly applied optimization were adding NOT NULL constraint which results in rejecting valid rows and reduced result set. The problem was that add_notnull_conds() while checking subquery were adding NOT NULL constraint to left joined table, to which, normally, optimization don't have to be applied.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/select.result11
-rw-r--r--mysql-test/t/select.test11
2 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 8160c5a2f3d..5c0616f9e54 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -2559,3 +2559,14 @@ WHERE
COUNT(*)
4
drop table t1,t2,t3;
+create table t1 (f1 int);
+insert into t1 values (1),(NULL);
+create table t2 (f2 int, f3 int, f4 int);
+create index idx1 on t2 (f4);
+insert into t2 values (1,2,3),(2,4,6);
+select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3)
+from t2 C where A.f4 = C.f4) or A.f3 IS NULL;
+f2
+1
+NULL
+drop table t1,t2;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 37e4324152b..2e261d0611f 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2116,3 +2116,14 @@ WHERE
drop table t1,t2,t3;
+#
+# Bug #11482 4.1.12 produces different resultset for a complex query
+# than in previous 4.1.x
+create table t1 (f1 int);
+insert into t1 values (1),(NULL);
+create table t2 (f2 int, f3 int, f4 int);
+create index idx1 on t2 (f4);
+insert into t2 values (1,2,3),(2,4,6);
+select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3)
+from t2 C where A.f4 = C.f4) or A.f3 IS NULL;
+drop table t1,t2;