summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-05-21 09:31:28 +0200
committerunknown <serg@serg.mylan>2004-05-21 09:31:28 +0200
commitc7d117fb631ca04fe3a7736712992c82d09551cd (patch)
treee6047a8746be26426dd50fc430c219bf5e91bd11 /sql
parentb98a465952d09373db79989ba06dd8921d18845e (diff)
downloadmariadb-git-c7d117fb631ca04fe3a7736712992c82d09551cd.tar.gz
asserting table->file->enable_indexes() in union re-execution
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_union.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index e56dd4b476e..70c05489f82 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -355,15 +355,18 @@ int st_select_lex_unit::exec()
if (uncacheable || !item || !item->assigned() || describe)
{
- if (optimized && item && item->assigned())
+ if (optimized && item)
{
- item->assigned(0); // We will reinit & rexecute unit
- item->reset();
- table->file->delete_all_rows();
+ if (item->assigned())
+ {
+ item->assigned(0); // We will reinit & rexecute unit
+ item->reset();
+ table->file->delete_all_rows();
+ }
+ /* re-enabling indexes for next subselect iteration */
+ if (union_distinct && table->file->enable_indexes(HA_KEY_SWITCH_ALL))
+ DBUG_ASSERT(1);
}
- if (union_distinct && table->file->enable_indexes(HA_KEY_SWITCH_ALL) &&
- !describe)
- DBUG_RETURN(1); // For sub-selects
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
{
ha_rows records_at_start= 0;