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/structs.h | |
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/structs.h')
-rw-r--r-- | sql/structs.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/structs.h b/sql/structs.h index 0a20eee0e9a..a58c18f97c5 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -107,6 +107,10 @@ typedef struct st_reginfo { /* Extra info about reg */ struct st_join_table *join_tab; /* Used by SELECT() */ enum thr_lock_type lock_type; /* How database is used */ bool not_exists_optimize; + /* + TRUE <=> range optimizer found that there is no rows satisfying + table conditions. + */ bool impossible_range; } REGINFO; |