Index: sql/sql_select.cc =================================================================== --- sql/sql_select.cc (revision 12926) +++ sql/sql_select.cc (working copy) @@ -11812,6 +11812,11 @@ tab->read_record.record=table->record[0]; if (!table->file->inited) table->file->ha_index_init(tab->index, tab->sorted); + if ((error = table->file->prepare_index_scan())) + { + report_error(table,error); + return -1; + } if ((error=tab->table->file->index_first(tab->table->record[0]))) { if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE) @@ -11851,6 +11856,11 @@ tab->read_record.record=table->record[0]; if (!table->file->inited) table->file->ha_index_init(tab->index, 1); + if ((error = table->file->prepare_index_scan())) + { + report_error(table,error); + return -1; + } if ((error= tab->table->file->index_last(tab->table->record[0]))) return report_error(table, error); return 0; Index: sql/handler.h =================================================================== --- sql/handler.h (revision 12926) +++ sql/handler.h (working copy) @@ -1926,6 +1926,9 @@ { return HA_ERR_WRONG_COMMAND; } virtual int rename_partitions(const char *path) { return HA_ERR_WRONG_COMMAND; } +public: + virtual int prepare_index_scan() + { return 0; } };