From 79a6e9dcda812157a56dc6abddee918ffb4a9755 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 11 Mar 2003 12:43:30 +0200 Subject: fixed cached constsnt determination (bug #142 related) mysql-test/r/subselect.result: test of constant redecing mysql-test/t/subselect.test: test of constant redecing sql/item_cmpfunc.cc: fixed cached constsnt determination --- sql/item_cmpfunc.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'sql/item_cmpfunc.cc') diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index ec3c7f22556..c4197beffbf 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -298,12 +298,22 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables, return 1; cache->setup(args[0]); if (cache->cols() == 1) - cache->set_used_tables(RAND_TABLE_BIT); + { + if (args[0]->used_tables()) + cache->set_used_tables(RAND_TABLE_BIT); + else + cache->set_used_tables(0); + } else { uint n= cache->cols(); for (uint i= 0; i < n; i++) - ((Item_cache *)cache->el(i))->set_used_tables(RAND_TABLE_BIT); + { + if (args[0]->el(i)->used_tables()) + ((Item_cache *)cache->el(i))->set_used_tables(RAND_TABLE_BIT); + else + ((Item_cache *)cache->el(i))->set_used_tables(0); + } } if (args[1]->fix_fields(thd, tables, args)) return 1; -- cgit v1.2.1