From aaf6334b6492ff915070378a61ed6e97881abfda Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 11 Sep 2015 15:48:34 +0400 Subject: [PATCH] MDEV-8709 Row equality elements do not get propagated The problem was fixed earlier by one of the MDEV-8728 subtasks. Adding a test case only. --- mysql-test/r/row.result | 22 ++++++++++++++++++++++ mysql-test/t/row.test | 18 ++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index f94c958a1be..59a606128f5 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -489,3 +489,25 @@ SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0); i DROP TABLE t1; End of 5.1 tests +# +# Start of 10.1 tests +# +# +# MDEV-8709 Row equality elements do not get propagated +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (10,10),(20,20); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND b=10 AND a>=10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 10) and (`test`.`t1`.`b` = 10)) +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,b)=(10,10) AND a>=10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 10) and (`test`.`t1`.`b` = 10)) +DROP TABLE t1; +# +# End of 10.1 tests +# diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test index fb49ce23644..9268a3e1086 100644 --- a/mysql-test/t/row.test +++ b/mysql-test/t/row.test @@ -285,3 +285,21 @@ SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0); DROP TABLE t1; --echo End of 5.1 tests + +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-8709 Row equality elements do not get propagated +--echo # +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (10,10),(20,20); +# Checking that the a>=10 part gets optimized away in both scalar and row notations +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND b=10 AND a>=10; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,b)=(10,10) AND a>=10; +DROP TABLE t1; + +--echo # +--echo # End of 10.1 tests +--echo #