• unknown's avatar
    Fixed LP BUG#641203: Query returns rows where no result is expected (impossible WHERE) · de35f143
    unknown authored
    The cause for the bug was two-fold:
    1. Incorrect detection of whether a table is the first one in a query plan -
      "used_table & 1" actually checks if used_table is table with number "1".
    2. Missing logic to delay the evaluation of (expensive) constant conditions
      during the execution phase.
    
    The fix adds/changes:
    The patch:
    - removes incorrect treatment of expensive predicates from make_cond_for_table,
      and lets the caller decide when to evaluate expensive predicates.
    - saves expensive constant conditions in JOIN::exec_const_cond,
      which is evaluated once in the beginning of JOIN::exec.
    de35f143
sql_select.h 69.8 KB