Re: [Maria-developers] [Commits] Rev 2935: Fixed LP bugs BUG#729067/730466. in file:///home/igor/maria/maria-5.3-bug729067/
Hi! Ok to push. 12 марта 2011, в 10:49, Igor Babaev написал(а):
At file:///home/igor/maria/maria-5.3-bug729067/
------------------------------------------------------------ revno: 2935 revision-id: igor@askmonty.org-20110312084903-b9mmi2wdgbdar3tc parent: timour@askmonty.org-20110308212344-7r4ue17b3rxschlj committer: Igor Babaev <igor@askmonty.org> branch nick: maria-5.3-bug729067 timestamp: Sat 2011-03-12 00:49:03 -0800 message: Fixed LP bugs BUG#729067/730466. Do not reset the value of the item_equal field in the Item_field object once it has been set. === modified file 'mysql-test/r/join.result' --- a/mysql-test/r/join.result 2011-02-28 21:29:59 +0000 +++ b/mysql-test/r/join.result 2011-03-12 08:49:03 +0000 @@ -1285,3 +1285,38 @@ 1 1 1 1 1 1 1 1 1 1 drop table t1,t2,t3; +# +# BUG#729067/730466: unexpected 'Range checked for each record' +# for queries with OR in WHERE clause +# +CREATE TABLE t1 (f1 int, f2 int) ; +INSERT INTO t1 VALUES (4,0),(5,1); +CREATE TABLE t2 (f1 int, f2 int, KEY (f2)) ; +INSERT INTO t2 VALUES (5,7), (8,9); +EXPLAIN +SELECT * FROM t1 STRAIGHT_JOIN t2 ON t2.f1 = t1.f1 +WHERE t1.f1<>0 OR t1.f2<>0 AND t1.f1 = t2.f2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t2 ALL f2 NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +SELECT * FROM t1 STRAIGHT_JOIN t2 ON t2.f1 = t1.f1 +WHERE t1.f1<>0 OR t1.f2<>0 AND t1.f1 = t2.f2; +f1 f2 f1 f2 +5 1 5 7 +DROP TABLE t1,t2; +CREATE TABLE t1(f1 int PRIMARY KEY, f2 int) ; +INSERT INTO t1 VALUES (9,4), (10,9); +CREATE TABLE t2(f1 int PRIMARY KEY, f2 int) ; +INSERT INTO t2 VALUES (9,4), (10,9); +EXPLAIN +SELECT STRAIGHT_JOIN * FROM t1 JOIN t2 ON t2.f2 = t1.f1 +WHERE t1.f1 IN (SELECT f1 FROM t1) AND t1.f1 = t2.f1 OR t1.f1 = 9; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 2 Using where +1 PRIMARY t2 ALL PRIMARY NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 SUBQUERY t1 index NULL PRIMARY 4 NULL 2 Using index +SELECT STRAIGHT_JOIN * FROM t1 JOIN t2 ON t2.f2 = t1.f1 +WHERE t1.f1 IN (SELECT f1 FROM t1) AND t1.f1 = t2.f1 OR t1.f1 = 9; +f1 f2 f1 f2 +9 4 10 9 +DROP TABLE t1,t2;
=== modified file 'mysql-test/t/join.test' --- a/mysql-test/t/join.test 2011-02-28 21:29:59 +0000 +++ b/mysql-test/t/join.test 2011-03-12 08:49:03 +0000 @@ -964,3 +964,36 @@
drop table t1,t2,t3;
+--echo # +--echo # BUG#729067/730466: unexpected 'Range checked for each record' +--echo # for queries with OR in WHERE clause +--echo # + +CREATE TABLE t1 (f1 int, f2 int) ; +INSERT INTO t1 VALUES (4,0),(5,1); + +CREATE TABLE t2 (f1 int, f2 int, KEY (f2)) ; +INSERT INTO t2 VALUES (5,7), (8,9); + +EXPLAIN +SELECT * FROM t1 STRAIGHT_JOIN t2 ON t2.f1 = t1.f1 + WHERE t1.f1<>0 OR t1.f2<>0 AND t1.f1 = t2.f2; +SELECT * FROM t1 STRAIGHT_JOIN t2 ON t2.f1 = t1.f1 + WHERE t1.f1<>0 OR t1.f2<>0 AND t1.f1 = t2.f2; + +DROP TABLE t1,t2; + +CREATE TABLE t1(f1 int PRIMARY KEY, f2 int) ; +INSERT INTO t1 VALUES (9,4), (10,9); + +CREATE TABLE t2(f1 int PRIMARY KEY, f2 int) ; +INSERT INTO t2 VALUES (9,4), (10,9); + +EXPLAIN +SELECT STRAIGHT_JOIN * FROM t1 JOIN t2 ON t2.f2 = t1.f1 + WHERE t1.f1 IN (SELECT f1 FROM t1) AND t1.f1 = t2.f1 OR t1.f1 = 9; +SELECT STRAIGHT_JOIN * FROM t1 JOIN t2 ON t2.f2 = t1.f1 + WHERE t1.f1 IN (SELECT f1 FROM t1) AND t1.f1 = t2.f1 OR t1.f1 = 9; + +DROP TABLE t1,t2; +
=== modified file 'sql/item_cmpfunc.cc' --- a/sql/item_cmpfunc.cc 2011-02-06 04:57:03 +0000 +++ b/sql/item_cmpfunc.cc 2011-03-12 08:49:03 +0000 @@ -5723,7 +5723,8 @@ not_null_tables_cache|= tmp_table_map; if (item->maybe_null) maybe_null=1; - item->item_equal= this; + if (!item->item_equal) + item->item_equal= this; } fix_length_and_dec(); fixed= 1;
_______________________________________________ commits mailing list commits@mariadb.org https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits
participants (1)
-
Oleksandr Byelkin