From: Roy Lyseng Date: December 16 2010 11:01pm Subject: Re: bzr commit into mysql-5.1 branch (ole.john.aske:3477) Bug#58490 List-Archive: http://lists.mysql.com/commits/127120 Message-Id: <4D0A9A39.3020405@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi Guilhem, about this section: > If I don't forget, I will later do a change which will save a useless test: we > have this code in evaluate_join_record(): > > bool select_cond_result= TRUE; > > if (error > 0 || (join->thd->is_error())) // Fatal error > return NESTED_LOOP_ERROR; > if (error < 0) > return NESTED_LOOP_NO_MORE_ROWS; > if (join->thd->killed) // Aborted by user > { > join->thd->send_kill_message(); > return NESTED_LOOP_KILLED; /* purecov: inspected */ > } > DBUG_PRINT("info", ("select cond 0x%lx", (ulong)select_cond)); > > if (select_cond) > { > select_cond_result= test(select_cond->val_int()); > > /* check for errors evaluating the condition */ > if (join->thd->is_error()) > return NESTED_LOOP_ERROR; > } > > if (!select_cond || select_cond_result) > { > ... > > I claim that the test above: > if (!select_cond || select_cond_result) > can be replaced with > if (select_cond_result) > because: > a) if (select_cond_result) is true then (!select_cond || select_cond_result) is > true too > b) if (!select_cond || select_cond_result) is true, then either: > b1) (select_cond_result) is true, or > b2) (!select_cond) is true, which means that the if(select_cond) was not > entered, so select_cond_result is still at its initial value, which is TRUE. In 5.6, I simplified this section by replacing "select_cond_result" with the more general "found" variable. IMHO, there is no need to elaborate the solution for 5.1/5.5. Thanks, Roy