[Commits] Rev 2878: Fix LP BUG#702345 in file:///home/tsk/mprog/src/5.3-mwl89/

timour at askmonty.org timour at askmonty.org
Mon Jan 17 13:48:22 EET 2011


At file:///home/tsk/mprog/src/5.3-mwl89/

------------------------------------------------------------
revno: 2878
revision-id: timour at askmonty.org-20110117114814-wuu2o3o9a0gkyl8l
parent: monty at askmonty.org-20110113232620-bz3akvsuzw7w34g5
committer: timour at askmonty.org
branch nick: 5.3-mwl89
timestamp: Mon 2011-01-17 13:48:14 +0200
message:
  Fix LP BUG#702345
  
  Analysis:
  Close to its end JOIN::optimize() assigns having to tmp_having, and
  sets the having clause to NULL:
  
    tmp_having= having;
    if (select_options & SELECT_DESCRIBE)
    {
      error= 0;
      DBUG_RETURN(0);
    }
    having= 0;
  
  At the same time, this query detects an empty result set, and calls
  return_zero_rows(), which checks the HAVING clause as follows:
  
      if (having && having->val_int() == 0)
        send_row=0;
  
  However having has been already set to NULL, so return_zero_rows
  doesn't check the having clause, hence the wrong result.
  
  Solution:
  Check join->tmp_having in addition to join->having.
  
  There is no additional test case, because the failure was in
  the current regression test.
-------------- next part --------------
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-01-13 23:26:20 +0000
+++ b/sql/sql_select.cc	2011-01-17 11:48:14 +0000
@@ -1907,7 +1907,7 @@ JOIN::exec()
                             send_row_on_empty_set(),
                             select_options,
                             zero_result_cause,
-                            having);
+                            having ? having : tmp_having);
     DBUG_VOID_RETURN;
   }
 



More information about the commits mailing list