diff --git a/sql/handler.cc b/sql/handler.cc index 4e8af034fd8..783e4d9ae20 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4759,6 +4759,7 @@ int handler::ha_reset() free_io_cache(table); /* reset the bitmaps to point to defaults */ table->default_column_bitmaps(); + pushed_cond= NULL; DBUG_RETURN(reset()); } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 9d75af5734a..ab8dfd54768 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3068,6 +3068,11 @@ retry_share: table->reginfo.lock_type=TL_READ; /* Assume read */ reset: + /* + Check that there is no reference to a condtion from an earlier query + (cf. Bug#58553). + */ + DBUG_ASSERT(table->file->pushed_cond == NULL); table_list->updatable= 1; // It is not derived table nor non-updatable VIEW table_list->table= table; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fc25e8ee0fa..be23443bcc0 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -6476,7 +6476,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) tab->select_cond=sel->cond=tmp; /* Push condition to storage engine if this is enabled and the condition is not guarded */ - tab->table->file->pushed_cond= NULL; if (thd->variables.optimizer_switch & OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) {