Igor, Could you please review this fix for bug lp:809266. Timour ------------------------------------------------------------ revno: 3104 revision-id: timour@askmonty.org-20110713211507-j9v80yk2tzae8tq2 parent: timour@askmonty.org-20110713141146-339e3xwz17hogqsb fixes bug(s): https://launchpad.net/bugs/809266 committer: timour@askmonty.org branch nick: 5.3-mwl89 timestamp: Thu 2011-07-14 00:15:07 +0300 message: Fix bug lp:809266 Analysis: This is a bug in MWL#68, where it was incorrectly assumed that if there is a match in the only non-null key, then if there is a covering NULL row on all remaining NULL-able columns there is a partial match. However, this is not the case, because even if there is such a null-only sub-row, it is not guaranteed to be part of the matched sub-row. The matched sub-row and the NULL-only sub-row may be parts of different rows. In fact there are two cases: - there is a complete row with only NULL values, and - all nullable columns contain only NULL values. These two cases were incorrectly mixed up in the class member subselect_partial_match_engine::covering_null_row_width. Solution: The solution is to: - split covering_null_row_width into two members: has_covering_null_row, and has_covering_null_columns, and - take into account each state during initialization and execution.