summaryrefslogtreecommitdiff
path: root/mysql-test/r/join.result
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2010-03-24 14:37:28 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2010-03-24 14:37:28 +0400
commitbccf219bfc61bb45d334b40d732651eb9bef5075 (patch)
treec59f93c73cda6e6b70f8b140a8ce67e81dc34aca /mysql-test/r/join.result
parent2a667b7bcbd8be59f9eb04fe6d3d6d4099baa2c2 (diff)
downloadmariadb-git-bccf219bfc61bb45d334b40d732651eb9bef5075.tar.gz
Bug#48483 crash in get_best_combination()
The crash happens because greedy_serach can not determine best plan due to wrong inner table dependences. These dependences affects join table sorting which performs before greedy_search starting. In our case table which has real 'no dependences' should be put on top of the list but it does not happen as inner tables have no dependences as well. The fix is to exclude RAND_TABLE_BIT mask from condition which checks if table dependences should be updated. mysql-test/r/join.result: test result mysql-test/t/join.test: test case sql/sql_select.cc: RAND_TABLE_BIT mask should not be counted as it prevents update of inner table dependences. For example it might happen if RAND() function is used in JOIN ON clause.
Diffstat (limited to 'mysql-test/r/join.result')
-rw-r--r--mysql-test/r/join.result17
1 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index 7d6ef5b40ba..bacfa81160a 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -913,4 +913,21 @@ ON t4.a = t5.a
ON t1.a = t3.a;
a a a a a a
DROP TABLE t1,t2,t3,t4,t5,t6;
+#
+# Bug#48483: crash in get_best_combination()
+#
+CREATE TABLE t1(f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE VIEW v1 AS SELECT 1 FROM t1 LEFT JOIN t1 AS t2 on 1=1;
+EXPLAIN EXTENDED
+SELECT 1 FROM v1 right join v1 AS v2 ON RAND();
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+Warnings:
+Note 1003 select 1 AS `1` from `test`.`t1` left join `test`.`t1` `t2` on((1 = 1)) left join (`test`.`t1` left join `test`.`t1` `t2` on((1 = 1))) on(rand()) where 1
+DROP VIEW v1;
+DROP TABLE t1;
End of 5.0 tests.