summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorSergey Petrunia <sergefp@mysql.com>2008-12-19 16:38:39 +0300
committerSergey Petrunia <sergefp@mysql.com>2008-12-19 16:38:39 +0300
commit7976735a0c34a35a7f726a2e985f53582db09282 (patch)
treed440dced3e9e4d9ef547b43b3da7faccb0baddaf /sql/opt_range.cc
parent56b9586fd1d94ebd70662417a1d2ac1921da4ad2 (diff)
downloadmariadb-git-7976735a0c34a35a7f726a2e985f53582db09282.tar.gz
BUG#40974: Incorrect query results when using clause evaluated using range check
- QUICK_INDEX_MERGE_SELECT deinitializes its rnd_pos() scan when it reaches EOF, but we need to make the deinitialization in QUICK_INDEX_MERGE_SELECT destructor also. This is because certain execution strategies can stop scanning without reaching EOF, then then try to do a full table scan on this table. Failure to deinitialize caused the full scan to use (already empty) table->sort and produce zero records. mysql-test/r/index_merge.result: BUG#40974: Incorrect query results when using clause evaluated using range check - Testcase mysql-test/t/index_merge.test: BUG#40974: Incorrect query results when using clause evaluated using range check - Testcase
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 204ebdb6f33..744415fa2fe 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1109,6 +1109,9 @@ QUICK_INDEX_MERGE_SELECT::~QUICK_INDEX_MERGE_SELECT()
quick->file= NULL;
quick_selects.delete_elements();
delete pk_quick_select;
+ /* It's ok to call the next two even if they are already deinitialized */
+ end_read_record(&read_record);
+ free_io_cache(head);
free_root(&alloc,MYF(0));
DBUG_VOID_RETURN;
}