summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect_innodb.test
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2005-10-13 11:53:00 +0400
committerunknown <konstantin@mysql.com>2005-10-13 11:53:00 +0400
commitd31e997d57c51ba5d1c4e80bbf402495a126f192 (patch)
tree1b8bb03febfb001c7548f0c3e434fa74bc71c9da /mysql-test/t/subselect_innodb.test
parent20a6f1524aef600d4dc39b9826ddcc4663a8049f (diff)
downloadmariadb-git-d31e997d57c51ba5d1c4e80bbf402495a126f192.tar.gz
A fix and a test case for Bug#12736 "Server crash during a select".
The bug was in JOIN::join_free which was wrongly determining that all joins have been already executed and therefore all used tables can be closed. mysql-test/r/subselect_innodb.result: - test results fixed (Bug#12736 "Server crash during a select mysql-test/t/subselect_innodb.test: - a test case for Bug#12736 "Server crash during a select": test that ha_index_or_rnd_end and mysql_unlock_tables are called for all used tables in proper order. sql/item_subselect.cc: - implement subselect_union_engine::is_executed sql/item_subselect.h: - implement Item_subselect::is_evaluated. This function is used to check whether we can clean up a non-correlated join of a subquery when cleaning up the join of the outer query sql/sql_lex.h: - declare st_select_lex::cleanup_all_joins sql/sql_select.cc: - remove an argument from JOIN::join_free, it's now not used - reimplement JOIN::join_free to not unlock tables if there is a subquery that has not yet been evaluated. Make sure that the new implementation calls ha_index_or_rnd_end for every table in the join and inner joins, because all table cursors must be closed before mysql_unlock_tables. sql/sql_select.h: - JOIN::join_free signature changed sql/sql_union.cc: - implement a helper method st_select_lex::cleanup_all_joins, which recursively walks over a tree of joins and calls cleanup() for each join.
Diffstat (limited to 'mysql-test/t/subselect_innodb.test')
-rw-r--r--mysql-test/t/subselect_innodb.test22
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test
index 3b1d2f393c2..a07cc93ad68 100644
--- a/mysql-test/t/subselect_innodb.test
+++ b/mysql-test/t/subselect_innodb.test
@@ -161,3 +161,25 @@ deallocate prepare my_stmt;
drop table t1,t2;
# End of 4.1 tests
+
+CREATE TABLE t1 (
+ school_name varchar(45) NOT NULL,
+ country varchar(45) NOT NULL,
+ funds_requested float NOT NULL,
+ schooltype varchar(45) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+insert into t1 values ("the school", "USA", 1200, "Human");
+
+select count(country) as countrycount, sum(funds_requested) as smcnt,
+ country, (select sum(funds_requested) from t1) as total_funds
+from t1
+group by country;
+
+select count(country) as countrycount, sum(funds_requested) as smcnt,
+ country, (select sum(funds_requested) from t1) as total_funds
+from t1
+group by country;
+
+drop table t1;
+