diff options
author | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2010-06-11 23:44:01 +0400 |
---|---|---|
committer | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2010-06-11 23:44:01 +0400 |
commit | 2400e54a1285cdc37d43390bdcfc61aa4bda545b (patch) | |
tree | 93e7b91e2cfc673080b7e3479223250d8db470e9 /sql | |
parent | 386929d3aee738cd0e3db335fb54e95bba8f9985 (diff) | |
parent | 9be5696aa187c94efd7694161517a974c9d81459 (diff) | |
download | mariadb-git-2400e54a1285cdc37d43390bdcfc61aa4bda545b.tar.gz |
Automerge.
Diffstat (limited to 'sql')
-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 3bbf4b78d07..bbc3d0b27a4 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -539,6 +539,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, @@ -561,9 +569,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 */ @@ -584,6 +599,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]); |