From: Ole John Aske Date: March 24 2011 10:00am Subject: bzr push into mysql-5.1-telco-7.0 branch (ole.john.aske:4253 to 4254) Bug#58553 List-Archive: http://lists.mysql.com/commits/133743 X-Bug: 58553 Message-Id: <20110324100034.0D635218@fimafeng09.norway.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4254 Ole John Aske 2011-03-24 Cherrypicked Fix for bug#58553 to 'mysql-5.1-telco-7.0': "Queries with pushed conditions causes 'explain extended' to crash mysqld". handler::pushed_cond was not always properly reset when table objects where recycled via the table cache. handler::pushed_cond is now set to NULL in handler::ha_reset(). This should prevent pushed conditions from (incorrectly) re-apperaring in later queries. modified: sql/handler.cc sql/sql_base.cc sql/sql_select.cc 4253 Ole John Aske 2011-03-24 Cherry picked fix for bug#51070 to mysql-5.1-telco-7.0. Required as this fix has already been cherrypicked to the SPJ branch, and we want to minimize the diff between SPJ and main telco branches. See: http://lists.mysql.com/commits/117686 for original commit message. modified: mysql-test/r/subselect4.result mysql-test/t/subselect4.test sql/item_cmpfunc.cc sql/item_subselect.cc === modified file 'sql/handler.cc' --- a/sql/handler.cc 2011-02-04 14:49:48 +0000 +++ b/sql/handler.cc 2011-03-24 10:00:09 +0000 @@ -4917,6 +4917,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()); } === modified file 'sql/sql_base.cc' --- a/sql/sql_base.cc 2010-10-22 14:13:23 +0000 +++ b/sql/sql_base.cc 2011-03-24 10:00:09 +0000 @@ -3001,6 +3001,11 @@ TABLE *open_table(THD *thd, TABLE_LIST * table->insert_values= 0; table->fulltext_searched= 0; table->file->ft_handler= 0; + /* + Check that there is no reference to a condtion from an earlier query + (cf. Bug#58553). + */ + DBUG_ASSERT(table->file->pushed_cond == NULL); table->reginfo.impossible_range= 0; /* Catch wrong handling of the auto_increment_field_not_null. */ DBUG_ASSERT(!table->auto_increment_field_not_null); === modified file 'sql/sql_select.cc' --- a/sql/sql_select.cc 2011-03-23 13:15:16 +0000 +++ b/sql/sql_select.cc 2011-03-24 10:00:09 +0000 @@ -6561,7 +6561,6 @@ make_join_select(JOIN *join,SQL_SELECT * 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.engine_condition_pushdown) { COND *push_cond= No bundle (reason: useless for push emails).