summaryrefslogtreecommitdiff
path: root/mysql-test/t/order_by.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-01-26 20:45:23 -0800
committerIgor Babaev <igor@askmonty.org>2011-01-26 20:45:23 -0800
commit3e868cd3cb2f9b9a851799deecf3e37db9b58dbb (patch)
treea43534b08ae46da9745a920a2980eec45fca42b1 /mysql-test/t/order_by.test
parenta624f99e98bdfaca785fb1bfeb33931b6fbd130a (diff)
downloadmariadb-git-3e868cd3cb2f9b9a851799deecf3e37db9b58dbb.tar.gz
Fixed LP bug #707848.
This was another bug in the patch for bug 698882. The new code from this patch did not ensured that substitutions of fields for best equal fields were performed on all AND-OR levels. As a result substitutions for best fields in some predicates that had been used by the range optimizer were not actually performed while range plans could employ these substitutions. This could lead to inconsistent data structures and ultimately to a crash.
Diffstat (limited to 'mysql-test/t/order_by.test')
-rw-r--r--mysql-test/t/order_by.test18
1 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 83aff014c16..e725e107c48 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -1497,5 +1497,23 @@ LIMIT 2;
DROP TABLE t1, t2;
+--echo #
+--echo # Bug #707848: WHERE condition with OR + ORDER BY + field substitution
+--echo #
+
+CREATE TABLE t1 (a int PRIMARY KEY);
+INSERT INTO t1 VALUES
+ (9), (7), (11), (15), (2), (4), (1), (5), (14), (54), (3), (8);
+
+EXPLAIN EXTENDED
+SELECT * FROM t1 r JOIN t1 s ON r.a = s.a
+ WHERE s.a IN (2,9) OR s.a < 100 AND s.a != 0
+ ORDER BY 1 LIMIT 10;
+
+SELECT * FROM t1 r JOIN t1 s ON r.a = s.a
+ WHERE s.a IN (2,9) OR s.a < 100 AND s.a != 0
+ ORDER BY 1 LIMIT 10;
+
+DROP TABLE t1;
--echo End of 5.1 tests