summaryrefslogtreecommitdiff
path: root/sql/item_subselect.cc
diff options
context:
space:
mode:
authorgluh@eagle.(none) <>2007-11-14 17:30:16 +0400
committergluh@eagle.(none) <>2007-11-14 17:30:16 +0400
commit58336411c9d624f0e99cf95aa5db22ec70dd0c6c (patch)
tree4676d6947f9f56056b0b29957c90cba5cdad5eba /sql/item_subselect.cc
parent6223deb694946e5a2c3e46eaf4f2ce5624b5e78a (diff)
parent95e7cccfee7f1b1df3e455fb5e6bc10ef49c2a3a (diff)
downloadmariadb-git-58336411c9d624f0e99cf95aa5db22ec70dd0c6c.tar.gz
Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into mysql.com:/home/gluh/MySQL/Merge/5.1-opt
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r--sql/item_subselect.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 8eb7421f854..423f067e54d 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1760,7 +1760,7 @@ void subselect_engine::set_row(List<Item> &item_list, Item_cache **row)
item->decimals= sel_item->decimals;
item->unsigned_flag= sel_item->unsigned_flag;
maybe_null= sel_item->maybe_null;
- if (!(row[i]= Item_cache::get_cache(res_type)))
+ if (!(row[i]= Item_cache::get_cache(sel_item)))
return;
row[i]->setup(sel_item);
}
@@ -2222,6 +2222,7 @@ int subselect_indexsubquery_engine::exec()
((Item_in_subselect *) item)->value= 0;
empty_result_set= TRUE;
null_keypart= 0;
+ table->status= 0;
if (check_null)
{
@@ -2234,6 +2235,16 @@ int subselect_indexsubquery_engine::exec()
if (copy_ref_key())
DBUG_RETURN(1);
+ if (table->status)
+ {
+ /*
+ We know that there will be no rows even if we scan.
+ Can be set in copy_ref_key.
+ */
+ ((Item_in_subselect *) item)->value= 0;
+ DBUG_RETURN(0);
+ }
+
if (null_keypart)
DBUG_RETURN(scan_table());