summaryrefslogtreecommitdiff
path: root/storage/maria
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2013-07-25 22:42:26 +0400
committerSergey Petrunya <psergey@askmonty.org>2013-07-25 22:42:26 +0400
commit9a780a59d53a905d8acf67e51cba5f1492e706b6 (patch)
tree6b383db88c8c731c2e8d2000593e843113ad7bc6 /storage/maria
parent9e13011efb137728e14a89d936616a14ebee8f59 (diff)
downloadmariadb-git-9a780a59d53a905d8acf67e51cba5f1492e706b6.tar.gz
MDEV-4687: impossible where with < operation, but =-5 return one row
- Let _ma_record_pos() set SEARCH_PART_KEY when doing a search on a prefix of a [unique] key. Otherwise, _ma_search_pos() would find the first key equal to search key, and assume it is also the last one, which will make a wrong estimate of key's position. A wrong key position may cause min_pos > max_pos and records_in_range() will return 0, which will make the optimizer think it's an impossible range while in fact it is not.
Diffstat (limited to 'storage/maria')
-rw-r--r--storage/maria/ma_range.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/storage/maria/ma_range.c b/storage/maria/ma_range.c
index bb72c10bba7..2a01359f1a1 100644
--- a/storage/maria/ma_range.c
+++ b/storage/maria/ma_range.c
@@ -144,6 +144,10 @@ static ha_rows _ma_record_pos(MARIA_HA *info, const uchar *key_data,
(HA_KEYSEG**) 0);
DBUG_EXECUTE("key", _ma_print_key(DBUG_FILE, &key););
nextflag=maria_read_vec[search_flag];
+
+ /* Indicate if we're doing a search on a key prefix */
+ if (((((key_part_map)1) << key.keyinfo->keysegs) - 1) != keypart_map)
+ nextflag |= SEARCH_PART_KEY;
/*
my_handler.c:ha_compare_text() has a flag 'skip_end_space'.