diff --git a/sql/ha_heap.h b/sql/ha_heap.h index aa675cfffea..504f5262bf3 100644 --- a/sql/ha_heap.h +++ b/sql/ha_heap.h @@ -41,13 +41,14 @@ class ha_heap: public handler { return (HA_READ_RND_SAME | HA_NO_INDEX | HA_KEYPOS_TO_RNDPOS | HA_NO_BLOBS | HA_NULL_KEY | HA_REC_NOT_IN_SEQ | - HA_NOT_READ_PREFIX_LAST | HA_NO_AUTO_INCREMENT); + HA_NO_AUTO_INCREMENT); } ulong index_flags(uint inx) const { return ((table->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ? (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER) : - (HA_ONLY_WHOLE_INDEX | HA_WRONG_ASCII_ORDER)); + (HA_ONLY_WHOLE_INDEX | HA_WRONG_ASCII_ORDER | + HA_NOT_READ_PREFIX_LAST)); } uint max_record_length() const { return HA_MAX_REC_LENGTH; } uint max_keys() const { return MAX_KEY; } diff --git a/sql/ha_isammrg.h b/sql/ha_isammrg.h index bbe75a74db8..c936a15164a 100644 --- a/sql/ha_isammrg.h +++ b/sql/ha_isammrg.h @@ -33,9 +33,9 @@ class ha_isammrg: public handler const char *table_type() const { return "MRG_ISAM"; } const char **bas_ext() const; ulong table_flags() const { return (HA_READ_RND_SAME | HA_KEYPOS_TO_RNDPOS | - HA_NOT_READ_PREFIX_LAST | HA_REC_NOT_IN_SEQ); } - ulong index_flags(uint idx) const { return 0; } + ulong index_flags(uint idx) const { return HA_NOT_READ_PREFIX_LAST; } + uint max_record_length() const { return HA_MAX_REC_LENGTH; } uint max_keys() const { return 0; } uint max_key_parts() const { return 0; } diff --git a/sql/handler.h b/sql/handler.h index c1f62dd26ef..c580a3a158a 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -81,7 +81,7 @@ #define HA_READ_PREV 4 /* Read prev. record with same key */ #define HA_READ_ORDER 8 /* Read through record-keys in order */ #define HA_ONLY_WHOLE_INDEX 16 /* Can't use part key searches */ -#define HA_NOT_READ_PREFIX_LAST 32 +#define HA_NOT_READ_PREFIX_LAST 32 /* No support for index_read_last() */ #define HA_KEY_READ_ONLY 64 /* Support HA_EXTRA_KEYREAD */ /* diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 3e2ed88a127..c2592f4aa65 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5576,7 +5576,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, Use a traversal function that starts by reading the last row with key part (A) and then traverse the index backwards. */ - if (table->file->table_flags() & HA_NOT_READ_PREFIX_LAST) + if (table->file->index_flags(ref_key) & HA_NOT_READ_PREFIX_LAST) DBUG_RETURN(0); // Use filesort tab->read_first_record= join_read_last_key; tab->read_record.read_record= join_read_prev_same;