summaryrefslogtreecommitdiff
path: root/mysql-test/t/select.test
diff options
context:
space:
mode:
authorigor@rurik.mysql.com <>2006-03-31 21:26:17 -0800
committerigor@rurik.mysql.com <>2006-03-31 21:26:17 -0800
commitaf2d79a7718b90e5e2459441d9527e961efaf863 (patch)
treec1688ec4197dcfa4edd2249ba974db0f44a99132 /mysql-test/t/select.test
parentea2aaa4e2fc5f9f7acd9c3ce369d2f13cb2d7d09 (diff)
downloadmariadb-git-af2d79a7718b90e5e2459441d9527e961efaf863.tar.gz
Fixed bug #16504.
Multiple equalities were not adjusted after reading constant tables. It resulted in neglecting good index based methods that could be used to access of other tables.
Diffstat (limited to 'mysql-test/t/select.test')
-rw-r--r--mysql-test/t/select.test23
1 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 01d5f2eb4d1..c4fe1906cbc 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2848,3 +2848,26 @@ drop table t1,t2;
#
--error 1064
select * from (select * left join t on f1=f2) tt;
+
+#
+# Bug #16504: re-evaluation of Item_equal object after reading const table
+#
+
+CREATE TABLE t1 (sku int PRIMARY KEY, pr int);
+CREATE TABLE t2 (sku int PRIMARY KEY, sppr int, name varchar(255));
+
+INSERT INTO t1 VALUES
+ (10, 10), (20, 10), (30, 20), (40, 30), (50, 10), (60, 10);
+
+INSERT INTO t2 VALUES
+ (10, 10, 'aaa'), (20, 10, 'bbb'), (30, 10, 'ccc'), (40, 20, 'ddd'),
+ (50, 10, 'eee'), (60, 20, 'fff'), (70, 20, 'ggg'), (80, 30, 'hhh');
+
+SELECT t2.sku, t2.sppr, t2.name, t1.sku, t1.pr
+ FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku);
+EXPLAIN
+SELECT t2.sku, t2.sppr, t2.name, t1.sku, t1.pr
+ FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku);
+
+
+DROP TABLE t1,t2;