diff options
author | Konstantin Osipov <kostja@sun.com> | 2010-06-17 17:31:51 +0400 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2010-06-17 17:31:51 +0400 |
commit | 484351d108b923038421b003f39770d3c96aeae0 (patch) | |
tree | 9413ba739bc0dbf1e647293756a3503f17dcde07 /sql/sql_handler.cc | |
parent | db0ee68b38a3506e6d6e74a976f2e2b9a6fb1772 (diff) | |
parent | 71377f189fd9d6ac59d66773168cfd2bd75a052a (diff) | |
download | mariadb-git-484351d108b923038421b003f39770d3c96aeae0.tar.gz |
Merge trunk-bugfixing -> trunk-runtime
Diffstat (limited to 'sql/sql_handler.cc')
-rw-r--r-- | sql/sql_handler.cc | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index b2e793b5938..d6f2a472e05 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -605,6 +605,14 @@ retry: my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), keyname, tables->alias); goto err; } + /* Check if the same index involved. */ + if ((uint) keyno != table->file->get_index()) + { + if (mode == RNEXT) + mode= RFIRST; + else if (mode == RPREV) + mode= RLAST; + } } if (insert_fields(thd, &thd->lex->select_lex.context, @@ -627,9 +635,16 @@ retry: case RNEXT: if (table->file->inited != handler::NONE) { - error=keyname ? - table->file->index_next(table->record[0]) : - table->file->rnd_next(table->record[0]); + if (keyname) + { + /* Check if we read from the same index. */ + DBUG_ASSERT((uint) keyno == table->file->get_index()); + error= table->file->index_next(table->record[0]); + } + else + { + error= table->file->rnd_next(table->record[0]); + } break; } /* else fall through */ @@ -650,6 +665,8 @@ retry: break; case RPREV: DBUG_ASSERT(keyname != 0); + /* Check if we read from the same index. */ + DBUG_ASSERT((uint) keyno == table->file->get_index()); if (table->file->inited != handler::NONE) { error=table->file->index_prev(table->record[0]); |