diff options
author | Georgi Kodinov <joro@sun.com> | 2009-09-03 18:03:46 +0300 |
---|---|---|
committer | Georgi Kodinov <joro@sun.com> | 2009-09-03 18:03:46 +0300 |
commit | 629557ff13e28e3422dfa1c354c44ef2fd62e4d0 (patch) | |
tree | 068d0eb56cfb6f3cf3efa8d825b43ac3f5c4f70a /mysql-test/t/subselect4.test | |
parent | 643fbe4234a06e51746c8912223652a3b41fe133 (diff) | |
download | mariadb-git-629557ff13e28e3422dfa1c354c44ef2fd62e4d0.tar.gz |
Bug #46791: Assertion failed:(table->key_read==0),function unknown
function,file sql_base.cc
When uncacheable queries are written to a temp table the optimizer must
preserve the original JOIN structure, because it is re-using the JOIN
structure to read from the resulting temporary table.
This was done only for uncacheable sub-queries.
But top level queries can also benefit from this mechanism, specially if
they're using index access and need a reset.
Fixed by not limiting the saving of JOIN structure to subqueries
exclusively.
Added a new test file to extend the existing (large) subquery.test.
Diffstat (limited to 'mysql-test/t/subselect4.test')
-rw-r--r-- | mysql-test/t/subselect4.test | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test new file mode 100644 index 00000000000..ff4cdf3c439 --- /dev/null +++ b/mysql-test/t/subselect4.test @@ -0,0 +1,32 @@ +# General purpose bug fix tests go here : subselect.test too large + + +--echo # +--echo # Bug #46791: Assertion failed:(table->key_read==0),function unknown +--echo # function,file sql_base.cc +--echo # + +CREATE TABLE t1 (a INT, b INT, KEY(a)); +INSERT INTO t1 VALUES (1,1),(2,2); +CREATE TABLE t2 LIKE t1; +INSERT INTO t2 VALUES (1,1),(2,2); +CREATE TABLE t3 LIKE t1; + +--echo # should have 1 impossible where and 2 dependent subqueries +EXPLAIN +SELECT 1 FROM t1 +WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3)) +ORDER BY count(*); + +--echo # should not crash the next statement +SELECT 1 FROM t1 +WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3)) +ORDER BY count(*); + +--echo # should not crash: the crash is caused by the previous statement +SELECT 1; + +DROP TABLE t1,t2,t3; + + +--echo End of 5.0 tests. |