1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

sql_select.cc:

Fixed bug #12144.
  Added an optimization that avoids key access with null keys for the 'ref'
  method when used in outer joins. The regilar optimization with adding
  IS NOT NULL expressions is not applied for outer join on expressions as
  the predicates of these expressions are not pushed down in 4.1.
null_key.result, null_key.test:
  Added a test case for bug #12144.
This commit is contained in:
igor@rurik.mysql.com
2005-07-28 13:31:15 -07:00
parent ef3bc773db
commit bcbde8af22
3 changed files with 65 additions and 1 deletions

View File

@ -2255,7 +2255,9 @@ add_key_field(KEY_FIELD **key_fields,uint and_level, Item_func *cond,
*/
(*key_fields)->null_rejecting= (cond->functype() == Item_func::EQ_FUNC) &&
((*value)->type() == Item::FIELD_ITEM) &&
((Item_field*)*value)->field->maybe_null();
(((Item_field*)*value)->field->maybe_null() ||
((Item_field *)*value)->field->table->maybe_null);
(*key_fields)++;
}
@ -6310,6 +6312,11 @@ join_read_always_key(JOIN_TAB *tab)
int error;
TABLE *table= tab->table;
for (uint i= 0 ; i < tab->ref.key_parts ; i++)
{
if ((tab->ref.null_rejecting & 1 << i) && tab->ref.items[i]->is_null())
return -1;
}
if (!table->file->inited)
table->file->ha_index_init(tab->ref.key);
if (cp_buffer_from_ref(tab->join->thd, &tab->ref))