summaryrefslogtreecommitdiff
path: root/sql/structs.h
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/structs.h
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/structs.h')
-rw-r--r--sql/structs.h4
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;