diff options
author | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2010-04-27 00:06:00 +0400 |
---|---|---|
committer | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2010-04-27 00:06:00 +0400 |
commit | 1a1fd04d840e89919209373e08e38ecd85e4864d (patch) | |
tree | cfe77065cf8869636a22b515e47cacc395291615 /sql/sql_select.cc | |
parent | e08507670486606bef7a9e462fa61bdf16340e12 (diff) | |
download | mariadb-git-1a1fd04d840e89919209373e08e38ecd85e4864d.tar.gz |
Backport of the fix for bug #50335 to 5.0.
The problem was in an incorrect debug assertion. The expression
used in the failing assertion states that when finding
references matching ORDER BY expressions, there can be only one
reference to a single table. But that does not make any sense,
all test cases for this bug are valid examples with multiple
identical WHERE expressions referencing the same table which
are also present in the ORDER BY list.
Fixed by removing the failing assertion. We also have to take
care of the 'found' counter so that we count multiple
references only once. We rely on this fact later in
eq_ref_table().
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 84de1fe241b..f0177893840 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -6720,9 +6720,11 @@ eq_ref_table(JOIN *join, ORDER *start_order, JOIN_TAB *tab) } if (order) { - found++; - DBUG_ASSERT(!(order->used & map)); - order->used|=map; + if (!(order->used & map)) + { + found++; + order->used|= map; + } continue; // Used in ORDER BY } if (!only_eq_ref_tables(join,start_order, (*ref_item)->used_tables())) |