summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorEvgeny Potemkin <epotemkin@mysql.com>2009-06-26 19:57:42 +0000
committerEvgeny Potemkin <epotemkin@mysql.com>2009-06-26 19:57:42 +0000
commit0e64988a5e96d705f0ff28690eb04805ad090e0b (patch)
treee5145db4b89d0e06b9c447aedfb4de4d11fafdbe /sql/sql_base.cc
parenta03275e91bed32f214f4f77a1a35a8b96b28afb5 (diff)
downloadmariadb-git-0e64988a5e96d705f0ff28690eb04805ad090e0b.tar.gz
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.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc1
1 files changed, 1 insertions, 0 deletions
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;