diff options
author | unknown <konstantin@mysql.com> | 2005-10-13 11:53:00 +0400 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2005-10-13 11:53:00 +0400 |
commit | d31e997d57c51ba5d1c4e80bbf402495a126f192 (patch) | |
tree | 1b8bb03febfb001c7548f0c3e434fa74bc71c9da /sql/item_subselect.h | |
parent | 20a6f1524aef600d4dc39b9826ddcc4663a8049f (diff) | |
download | mariadb-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 'sql/item_subselect.h')
-rw-r--r-- | sql/item_subselect.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 5b22930ae1f..f1c99f74498 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -110,6 +110,12 @@ public: return eng == 0; } /* + True if this subquery has been already evaluated. Implemented only for + single select and union subqueries only. + */ + bool is_evaluated() const; + + /* Used by max/min subquery to initialize value presence registration mechanism. Engine call this method before rexecution query. */ @@ -317,6 +323,7 @@ public: virtual void print(String *str)= 0; virtual bool change_result(Item_subselect *si, select_subselect *result)= 0; virtual bool no_tables()= 0; + virtual bool is_executed() const { return FALSE; } }; @@ -342,6 +349,7 @@ public: void print (String *str); bool change_result(Item_subselect *si, select_subselect *result); bool no_tables(); + bool is_executed() const { return executed; } }; @@ -363,6 +371,7 @@ public: void print (String *str); bool change_result(Item_subselect *si, select_subselect *result); bool no_tables(); + bool is_executed() const; }; @@ -411,3 +420,10 @@ public: int exec(); void print (String *str); }; + + +inline bool Item_subselect::is_evaluated() const +{ + return engine->is_executed(); +} + |