summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/table.cc b/sql/table.cc
index f24f5c6fbcc..ce894e6910f 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -780,7 +780,12 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
the primary key, then we can use any key to find this column
*/
if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX)
+ {
field->part_of_key= share->keys_in_use;
+ if (share->db_type == DB_TYPE_INNODB &&
+ field->part_of_sortkey.is_set(key))
+ field->part_of_sortkey= share->keys_in_use;
+ }
}
if (field->key_length() != key_part->length)
{