List:Commits« Previous MessageNext Message »
From:Guilhem Bichot Date:June 1 2011 2:10pm
Subject:possible bug for EXPLAIN UPDATE/DELETE
View as plain text  
Hello Gleb,

There is this code which can be executed by EXPLAIN SELECT: in 
open_and_lock_tables():

   if (derived)
   {
     if (mysql_handle_derived(thd->lex, &mysql_derived_prepare))
       goto err;
     if (thd->fill_derived_tables() &&
         mysql_handle_derived(thd->lex, &mysql_derived_filling))
     {
       mysql_handle_derived(thd->lex, &mysql_derived_cleanup);
       goto err;
     }
     if (!(thd->lex->describe))
       mysql_handle_derived(thd->lex, &mysql_derived_cleanup);

see: if EXPLAIN, we don't call mysql_derived_cleanup() at this stage, 
because we need structures to live until we can explain them.

There are in sql_update.cc some _unconditional_ calls:
   mysql_handle_derived(thd->lex, &mysql_derived_cleanup);
which, I suspect, might crash with EXPLAIN UPDATE or EXPLAIN multi-table 
UPDATE if a derived table is used (in the FROM).

Could you please check, add some MTR tests?

Thanks!
Thread
possible bug for EXPLAIN UPDATE/DELETEGuilhem Bichot1 Jun
  • Re: possible bug for EXPLAIN UPDATE/DELETEGleb Shchepa1 Jun