From 93bac51ef33b2f368bb81064481ca9398c2480ef Mon Sep 17 00:00:00 2001 From: Evgeny Potemkin Date: Fri, 26 Jun 2009 19:57:42 +0000 Subject: Bug#45266: Uninitialized variable lead to an empty result. The TABLE::reginfo.impossible_range is used by the optimizer to indicate that the condition applied to the table is impossible. It wasn't initialized at table opening and this might lead to an empty result on complex queries: a query might set the impossible_range flag on a table and when the query finishes, all tables are returned back to the table cache. The next query that uses the table with the impossible_range flag set and an index over the table will see the flag and thus return an empty result. The open_table function now initializes the TABLE::reginfo.impossible_range variable. mysql-test/r/select.result: A test case for the bug#45266: Uninitialized variable lead to an empty result. mysql-test/t/select.test: A test case for the bug#45266: Uninitialized variable lead to an empty result. sql/sql_base.cc: Bug#45266: Uninitialized variable lead to an empty result. The open_table function now initializes the TABLE::reginfo.impossible_range variable. sql/sql_select.cc: Bug#45266: Uninitialized variable lead to an empty result. The open_table function now initializes the TABLE::reginfo.impossible_range variable. sql/structs.h: Bug#45266: Uninitialized variable lead to an empty result. A comment is added. --- sql/sql_base.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/sql_base.cc') diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 134b45a9100..88e1620b152 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2963,6 +2963,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, table->insert_values= 0; table->fulltext_searched= 0; table->file->ft_handler= 0; + table->reginfo.impossible_range= 0; /* Catch wrong handling of the auto_increment_field_not_null. */ DBUG_ASSERT(!table->auto_increment_field_not_null); table->auto_increment_field_not_null= FALSE; -- cgit v1.2.1