diff options
author | Evgeny Potemkin <epotemkin@mysql.com> | 2009-06-26 19:57:42 +0000 |
---|---|---|
committer | Evgeny Potemkin <epotemkin@mysql.com> | 2009-06-26 19:57:42 +0000 |
commit | 93bac51ef33b2f368bb81064481ca9398c2480ef (patch) | |
tree | e5145db4b89d0e06b9c447aedfb4de4d11fafdbe /sql/sql_base.cc | |
parent | 59947ae6bdd81a62b2682163cb430520b54c0551 (diff) | |
download | mariadb-git-93bac51ef33b2f368bb81064481ca9398c2480ef.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.
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.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 1 |
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; |