diff options
author | bell@sanja.is.com.ua <> | 2003-09-08 21:58:09 +0300 |
---|---|---|
committer | bell@sanja.is.com.ua <> | 2003-09-08 21:58:09 +0300 |
commit | 813d81c72692b1d9512064ccef193aa317a6e627 (patch) | |
tree | 6e3d79983d2b08c89ad3d6f947f76ff98cccf68f /sql/item_subselect.cc | |
parent | 90bd948e1e416f3cf1b692f1e679b250f625dbbc (diff) | |
download | mariadb-git-813d81c72692b1d9512064ccef193aa317a6e627.tar.gz |
removing additional IN subquery condition
fixed IN optimisation bug
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r-- | sql/item_subselect.cc | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 79366086a8d..773c7ddd9de 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -576,6 +576,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, item= new Item_cond_or(item, new Item_func_isnull(isnull)); } + item->name= (char *)in_additional_cond; join->conds= and_items(join->conds, item); if (join->conds->fix_fields(thd, join->tables_list, &join->conds)) DBUG_RETURN(RES_ERROR); @@ -971,6 +972,7 @@ int subselect_indexin_engine::exec() { DBUG_ENTER("subselect_indexin_engine::exec"); int error; + bool null_finding= 0; TABLE *table= tab->table; ((Item_in_subselect *) item)->value= 0; @@ -1002,29 +1004,30 @@ int subselect_indexin_engine::exec() { if (!cond || cond->val_int()) { - if (check_null && *tab->null_ref_key) + if (null_finding) ((Item_in_subselect *) item)->was_null= 1; else ((Item_in_subselect *) item)->value= 1; goto finish; } + error= table->file->index_next_same(table->record[0], + tab->ref.key_buff, + tab->ref.key_length); + if (error && error != HA_ERR_END_OF_FILE) + { + error= report_error(table, error); + goto finish; + } } else { - if (!check_null || *tab->null_ref_key) + if (!check_null || null_finding) goto finish; *tab->null_ref_key= 1; + null_finding= 1; if (safe_index_read(tab)) goto finish; } - error= table->file->index_next_same(table->record[0], - tab->ref.key_buff, - tab->ref.key_length); - if (error && error != HA_ERR_KEY_NOT_FOUND) - { - error= report_error(table, error); - goto finish; - } } } } |