From a9760355dc8b22e2a9fc2066bf67c64c14205a9e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 May 2007 19:38:34 +0300 Subject: Bug#22855: Conversion errors when constructing the condition for an IN predicates were treated as if the affected column contains NULL. If such a IN predicate is inside NOT we get wrong results. Corrected the handling of conversion errors in an IN predicate that is resolved by unique_subquery (through subselect_uniquesubquery_engine). mysql-test/r/subselect3.result: Bug#22855: test case mysql-test/t/subselect3.test: Bug#22855: test case sql/item_subselect.cc: Bug#22855: corrected the handling of conversion errors and NULL key values in IN predicate that is resolved by index lookup. --- mysql-test/t/subselect3.test | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'mysql-test/t/subselect3.test') diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test index e8eae3e2452..178d95dfff9 100644 --- a/mysql-test/t/subselect3.test +++ b/mysql-test/t/subselect3.test @@ -531,3 +531,21 @@ SELECT a, MAX(b), DROP TABLE t1, t2; + +# +# Bug #22855: Optimizer doesn't rewrite NOT IN subselects to a correlated +# subquery +# +CREATE TABLE t1 (a INT NOT NULL); +INSERT INTO t1 VALUES (1),(-1), (65),(66); + +CREATE TABLE t2 (a INT UNSIGNED NOT NULL PRIMARY KEY); +INSERT INTO t2 VALUES (65),(66); + +SELECT a FROM t1 WHERE a NOT IN (65,66); +SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2); +EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2); + +DROP TABLE t1; + +--echo End of 5.0 tests -- cgit v1.2.1 From 75c454876da59171ef5b3dfa38a978bf3ff4071f Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 1 Jun 2007 17:49:01 +0400 Subject: Fix some mysqltest warnings. mysql-test/r/sp.result: Update results. mysql-test/t/mysql.test: Fix a typo. mysql-test/t/mysqltest.test: Fix a typo. mysql-test/t/order_by.test: Fix a typo. mysql-test/t/row.test: Remove an unsupported command. mysql-test/t/sp.test: Fix a typo. mysql-test/t/subselect3.test: Fix mysqltest warnings - now it warns when sees some suspicious -- comment --- mysql-test/t/subselect3.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mysql-test/t/subselect3.test') diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test index 65556012588..14dbb72de7b 100644 --- a/mysql-test/t/subselect3.test +++ b/mysql-test/t/subselect3.test @@ -260,11 +260,11 @@ insert into t2 values ('dd', 1, NULL); alter table t1 add index idx(ie1,ie2); ---cc 3 NULL NULL +# cc 3 NULL NULL select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=3 and b is null ; insert into t2 values ('new1', 10,10); insert into t1 values ('new1', 1234, 10, NULL); --- new1, 10, 10, NULL, +# new1, 10, 10, NULL, select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=10 and b=10; explain extended select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=10 and b=10; -- cgit v1.2.1