summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <igor@olga.mysql.com>2007-03-12 02:24:09 -0700
committerunknown <igor@olga.mysql.com>2007-03-12 02:24:09 -0700
commited80fe2dfb68b30c6f41b5e0beae1be4394e63cf (patch)
treed8e0de2ce31605ff0933681211860a504d50d0d0 /sql
parent91abf15ed29a33fd6e02f00ad5088d7f8d041bc2 (diff)
parent13c05162f34451d19759230e24f81b34034e23b8 (diff)
downloadmariadb-git-ed80fe2dfb68b30c6f41b5e0beae1be4394e63cf.tar.gz
Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug26963 mysql-test/r/select.result: Auto merged mysql-test/t/select.test: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/item.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc
index ec33bf1ddc7..11a5039ca19 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -4075,7 +4075,9 @@ bool Item_field::set_no_const_sub(byte *arg)
DESCRIPTION
The function returns a pointer to an item that is taken from
the very beginning of the item_equal list which the Item_field
- object refers to (belongs to).
+ object refers to (belongs to) unless item_equal contains a constant
+ item. In this case the function returns this constant item,
+ (if the substitution does not require conversion).
If the Item_field object does not refer any Item_equal object
'this' is returned
@@ -4084,7 +4086,8 @@ bool Item_field::set_no_const_sub(byte *arg)
of the thransformer method.
RETURN VALUES
- pointer to a replacement Item_field if there is a better equal item;
+ pointer to a replacement Item_field if there is a better equal item or
+ a pointer to a constant equal item;
this - otherwise.
*/
@@ -4092,6 +4095,14 @@ Item *Item_field::replace_equal_field(byte *arg)
{
if (item_equal)
{
+ Item *const_item= item_equal->get_const();
+ if (const_item)
+ {
+ if (cmp_context != (Item_result)-1 &&
+ const_item->cmp_context != cmp_context)
+ return this;
+ return const_item;
+ }
Item_field *subst= item_equal->get_first();
if (subst && !field->eq(subst->field))
return subst;