summaryrefslogtreecommitdiff
path: root/mysql-test/r/derived.result
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-06-23 14:48:45 -0700
committerIgor Babaev <igor@askmonty.org>2011-06-23 14:48:45 -0700
commit3cf0d6f446b51b76a53378a11a117a134158f407 (patch)
treedd1fdd620dea52b00c2b3fb8ed728a8b0f4c6acc /mysql-test/r/derived.result
parent1f6b32bc370f5a0f05ab0e1ee79ede6bb58b71d4 (diff)
downloadmariadb-git-3cf0d6f446b51b76a53378a11a117a134158f407.tar.gz
Fixed LP bug #800518.
The function simple_pred did not take into account that a multiple equality could include ref items (more exactly items of the class Item_direct_view_ref). It caused crashes for queries over derived tables or views if the min/max optimization could be applied to these queries.
Diffstat (limited to 'mysql-test/r/derived.result')
-rw-r--r--mysql-test/r/derived.result16
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index fe803ed37a5..0340ebcbe98 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -425,3 +425,19 @@ SELECT * FROM (SELECT DISTINCT * FROM t2) t, t1 WHERE t1.a = t.a;
a a
3 3
DROP TABLE t1,t2;
+#
+# LP bug #800518: crash with a query over a derived table
+# when a min/max optimization is applied
+#
+CREATE TABLE t1 (a int, b int, c varchar(10), INDEX idx(a,b)) ;
+INSERT INTO t1 VALUES
+(100, 3, 'xxx'), (200, 7, 'yyyyyyy'), (100, 1, 't'),
+(200, 4, 'aaaa'), (100, 3, 'eee'), (100, 5, 'zzzzz');
+EXPLAIN
+SELECT MAX(b) FROM (SELECT * FROM t1) AS t WHERE a = 100;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+SELECT MAX(b) FROM (SELECT * FROM t1) AS t WHERE a = 100;
+MAX(b)
+5
+DROP TABLE t1;