summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <kgeorge@mysql.com>2008-11-29 15:36:17 +0200
committerGeorgi Kodinov <kgeorge@mysql.com>2008-11-29 15:36:17 +0200
commitf486bfbbdb8eeaca11428c7822472150f11185cc (patch)
tree96b3689cd0dc7e80ac771f9f06aa4c305315a518 /sql/table.cc
parentf309f847e4ae66fddada8fb97d3b029eb71ab6c0 (diff)
downloadmariadb-git-f486bfbbdb8eeaca11428c7822472150f11185cc.tar.gz
Bug #37742: HA_EXTRA_KEYREAD flag is set when key contains only prefix of requested
column When the storage engine uses secondary keys clustered with the primary key MySQL was adding the primary key parts to each secondary key. In doing so it was not checking whether the index was on full columns and this resulted in the secondary keys being added to the list of covering keys even if they have partial columns. Fixed by not adding a primary key part to the list of columns that can be used for index read of the secondary keys when the primary key part is a partial key part.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 89714e4e47e..1de47a48513 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1416,7 +1416,9 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
*/
if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX)
{
- field->part_of_key= share->keys_in_use;
+ if (field->key_length() == key_part->length &&
+ !(field->flags & BLOB_FLAG))
+ field->part_of_key= share->keys_in_use;
if (field->part_of_sortkey.is_set(key))
field->part_of_sortkey= share->keys_in_use;
}