diff options
author | Gleb Shchepa <gshchepa@mysql.com> | 2009-04-28 05:19:13 +0500 |
---|---|---|
committer | Gleb Shchepa <gshchepa@mysql.com> | 2009-04-28 05:19:13 +0500 |
commit | def04705986a9abad6927c0b52aaf63c136b546b (patch) | |
tree | c349900b74ab8eb5bf4cda529dfa3b8b933ebd7e /sql/item.cc | |
parent | b7a70c8b3d30db6007b5e731ae2790e9c963d8c9 (diff) | |
download | mariadb-git-def04705986a9abad6927c0b52aaf63c136b546b.tar.gz |
backport from 6.0:
Bug #40925: Equality propagation takes non indexed attribute
Query execution plans and execution time of queries like
select a, b, c from t1
where a > '2008-11-21' and b = a limit 10
depended on the order of equality operator parameters:
"b = a" and "a = b" are not same.
An equality propagation algorithm has been fixed:
the substitute_for_best_equal_field function should not
substitute a field for an equal field if both fields belong
to the same table.
mysql-test/r/select.result:
Added test case for bug #40925.
mysql-test/t/select.test:
Added test case for bug #40925.
sql/item.cc:
Bug #40925: Equality propagation takes non indexed attribute
An equality propagation algorithm has been fixed:
the substitute_for_best_equal_field function should not
substitute a field for an equal field if both fields belong
to the same table.
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc index c284e8b3bf4..13f09914ec6 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4341,7 +4341,7 @@ Item *Item_field::replace_equal_field(byte *arg) return const_item; } Item_field *subst= item_equal->get_first(); - if (subst && !field->eq(subst->field)) + if (subst && field->table != subst->field->table && !field->eq(subst->field)) return subst; } return this; |