summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2003-04-16 21:10:45 +0300
committerunknown <Sinisa@sinisa.nasamreza.org>2003-04-16 21:10:45 +0300
commita6dbd490d885a9d9d13ccc1ccaf51afc9d1b499e (patch)
tree3c2a85deb97f21f132191bc92097ab6a5a707d92
parentc4d9b9c61ceb5cad768efd7a53744e5aa12146a8 (diff)
downloadmariadb-git-a6dbd490d885a9d9d13ccc1ccaf51afc9d1b499e.tar.gz
Fix for a bug with InnoDB SQL handler, when previous query failed
and an attempt is made to read previous / next value.
-rw-r--r--mysql-test/r/innodb_handler.result10
-rw-r--r--mysql-test/t/innodb_handler.test8
-rw-r--r--sql/ha_innodb.cc3
3 files changed, 19 insertions, 2 deletions
diff --git a/mysql-test/r/innodb_handler.result b/mysql-test/r/innodb_handler.result
index 321aedabdc7..949756a6546 100644
--- a/mysql-test/r/innodb_handler.result
+++ b/mysql-test/r/innodb_handler.result
@@ -139,4 +139,12 @@ a b
alter table t1 type=innodb;
handler t2 read first;
Unknown table 't2' in HANDLER
-drop table if exists t1;
+drop table t1;
+CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)) TYPE=InnoDB;
+INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
+HANDLER t1 OPEN;
+HANDLER t1 READ `primary` = (1, 1000);
+no1 no2
+HANDLER t1 READ `primary` PREV;
+no1 no2
+DROP TABLE t1;
diff --git a/mysql-test/t/innodb_handler.test b/mysql-test/t/innodb_handler.test
index c6448eba3ef..6777e4f49bd 100644
--- a/mysql-test/t/innodb_handler.test
+++ b/mysql-test/t/innodb_handler.test
@@ -72,5 +72,11 @@ alter table t1 type=innodb;
--error 1109
handler t2 read first;
-drop table if exists t1;
+drop table t1;
+CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)) TYPE=InnoDB;
+INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
+HANDLER t1 OPEN;
+HANDLER t1 READ `primary` = (1, 1000);
+HANDLER t1 READ `primary` PREV;
+DROP TABLE t1;
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index edafc142fd3..d55595d4c84 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -2579,6 +2579,9 @@ ha_innobase::general_fetch(
ut_a(prebuilt->trx ==
(trx_t*) current_thd->transaction.all.innobase_tid);
+ if (table->status == STATUS_NOT_FOUND)
+ DBUG_RETURN(HA_ERR_KEY_NOT_FOUND);
+
srv_conc_enter_innodb(prebuilt->trx);
ret = row_search_for_mysql((byte*)buf, 0, prebuilt, match_mode,