Commit dad32c93 authored by unknown's avatar unknown

Fix for a bug with InnoDB SQL handler, when previous query failed

and an attempt is made to read previous / next value.

parent 674d512d
...@@ -139,4 +139,12 @@ a b ...@@ -139,4 +139,12 @@ a b
alter table t1 type=innodb; alter table t1 type=innodb;
handler t2 read first; handler t2 read first;
Unknown table 't2' in HANDLER 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;
...@@ -72,5 +72,11 @@ alter table t1 type=innodb; ...@@ -72,5 +72,11 @@ alter table t1 type=innodb;
--error 1109 --error 1109
handler t2 read first; 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;
...@@ -2579,6 +2579,9 @@ ha_innobase::general_fetch( ...@@ -2579,6 +2579,9 @@ ha_innobase::general_fetch(
ut_a(prebuilt->trx == ut_a(prebuilt->trx ==
(trx_t*) current_thd->transaction.all.innobase_tid); (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); srv_conc_enter_innodb(prebuilt->trx);
ret = row_search_for_mysql((byte*)buf, 0, prebuilt, match_mode, ret = row_search_for_mysql((byte*)buf, 0, prebuilt, match_mode,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment