diff options
author | Ramil Kalimullin <ramil@mysql.com> | 2010-06-11 19:36:57 +0400 |
---|---|---|
committer | Ramil Kalimullin <ramil@mysql.com> | 2010-06-11 19:36:57 +0400 |
commit | 20e0a9ab8f383cfe5751400a54364ca572aeb3de (patch) | |
tree | 3d7440e2bdd94a35d1f6c607f494dfd9a387c406 /sql/sql_handler.cc | |
parent | 1ab6c34341fb78584f943a1d5702e99df36fa9de (diff) | |
parent | d4746b8e84de4cde79269a79d2137ac75cb06682 (diff) | |
download | mariadb-git-20e0a9ab8f383cfe5751400a54364ca572aeb3de.tar.gz |
Automerge.
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 23177b8f51a..b9cc0ef477d 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -607,6 +607,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, @@ -629,9 +637,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 */ @@ -652,6 +667,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]); |