diff options
author | unknown <igor@olga.mysql.com> | 2007-02-13 01:34:36 -0800 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-02-13 01:34:36 -0800 |
commit | 21df932dbdd63e2c0128334f761f23577c74b45c (patch) | |
tree | 0ebadd1cbf0ccf30ae7b01d82842db102e6a9fb3 /sql/opt_range.cc | |
parent | 9292b57707fb0a2ccd6fb07a777a0f2089f8f6c5 (diff) | |
parent | 4c2bc81ae762072973528e306c8fa80031b076b2 (diff) | |
download | mariadb-git-21df932dbdd63e2c0128334f761f23577c74b45c.tar.gz |
Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into olga.mysql.com:/home/igor/mysql-5.1-opt
BitKeeper/etc/gone:
auto-union
mysql-test/r/insert_select.result:
Auto merged
mysql-test/r/join_outer.result:
Auto merged
mysql-test/r/select.result:
Auto merged
mysql-test/r/view.result:
Auto merged
mysql-test/t/insert_select.test:
Auto merged
mysql-test/t/join_outer.test:
Auto merged
mysql-test/t/select.test:
Auto merged
mysys/my_getopt.c:
Auto merged
sql/field.h:
Auto merged
sql/field_conv.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/table.cc:
Auto merged
sql/table.h:
Auto merged
mysql-test/include/mix1.inc:
Manual merge
mysql-test/r/information_schema.result:
Manual merge
mysql-test/r/innodb_mysql.result:
Manual merge
mysql-test/t/information_schema.test:
Manual merge
mysql-test/t/view.test:
Manual merge
mysys/my_pthread.c:
Manual merge
sql/mysql_priv.h:
Manual merge
sql/opt_range.cc:
Manual merge
sql/sql_insert.cc:
Manual merge
sql/sql_update.cc:
Manual merge
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index f613b1b9f02..2e31b72fa5c 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -5595,7 +5595,22 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field, err= value->save_in_field_no_warnings(field, 1); if (err > 0 && field->cmp_type() != value->result_type()) { - tree= 0; + if ((type == Item_func::EQ_FUNC || type == Item_func::EQUAL_FUNC) && + value->result_type() == item_cmp_type(field->result_type(), + value->result_type())) + + { + tree= new (alloc) SEL_ARG(field, 0, 0); + tree->type= SEL_ARG::IMPOSSIBLE; + } + else + { + /* + TODO: We should return trees of the type SEL_ARG::IMPOSSIBLE + for the cases like int_field > 999999999999999999999999 as well. + */ + tree= 0; + } goto end; } if (err < 0) @@ -10158,14 +10173,13 @@ int QUICK_GROUP_MIN_MAX_SELECT::reset(void) DBUG_ENTER("QUICK_GROUP_MIN_MAX_SELECT::reset"); file->extra(HA_EXTRA_KEYREAD); /* We need only the key attributes */ - result= file->ha_index_init(index, 1); - result= file->index_last(record); - if (result == HA_ERR_END_OF_FILE) - DBUG_RETURN(0); - if (result) + if ((result= file->ha_index_init(index))) DBUG_RETURN(result); if (quick_prefix_select && quick_prefix_select->reset()) DBUG_RETURN(1); + result= file->index_last(record); + if (result == HA_ERR_END_OF_FILE) + DBUG_RETURN(0); /* Save the prefix of the last group. */ key_copy(last_prefix, record, index_info, group_prefix_len); @@ -10214,7 +10228,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::get_next() #else int result; #endif - int is_last_prefix; + int is_last_prefix= 0; DBUG_ENTER("QUICK_GROUP_MIN_MAX_SELECT::get_next"); @@ -10229,13 +10243,18 @@ int QUICK_GROUP_MIN_MAX_SELECT::get_next() Check if this is the last group prefix. Notice that at this point this->record contains the current prefix in record format. */ - is_last_prefix= key_cmp(index_info->key_part, last_prefix, - group_prefix_len); - DBUG_ASSERT(is_last_prefix <= 0); - if (result == HA_ERR_KEY_NOT_FOUND) - continue; - if (result) + if (!result) + { + is_last_prefix= key_cmp(index_info->key_part, last_prefix, + group_prefix_len); + DBUG_ASSERT(is_last_prefix <= 0); + } + else + { + if (result == HA_ERR_KEY_NOT_FOUND) + continue; break; + } if (have_min) { |