Commit 9cbb009b authored by Gleb Shchepa's avatar Gleb Shchepa

Bug #53450: Crash / assertion "virtual int

            ha_myisam::index_first(uchar*)") at assert.c:81

Single-table DELETE crash/assertion similar to single-table
UPDATE bug 14272.

Same resolution as for the bug 14272:
Don't run index scan when we should use quick select.
This could cause failures because there are table handlers (like federated)
that support quick select scanning but do not support index scanning.


mysql-test/r/delete.result:
  Test case for bug #53450.
mysql-test/t/delete.test:
  Test case for bug #53450.
sql/sql_delete.cc:
  Bug #53450: Crash / assertion "virtual int
              ha_myisam::index_first(uchar*)") at assert.c:81
  
  The mysql_delete function has been modified to not to use
  init_read_record_idx instead of init_read_record for the
  quick select.
parent feb03a82
...@@ -349,4 +349,13 @@ END | ...@@ -349,4 +349,13 @@ END |
DELETE IGNORE FROM t1; DELETE IGNORE FROM t1;
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
DROP TABLE t1; DROP TABLE t1;
#
# Bug #53450: Crash/assertion
# "virtual int ha_myisam::index_first(uchar*)") at assert.c:81
#
CREATE TABLE t1 (a INT, b INT, c INT,
INDEX(a), INDEX(b), INDEX(c));
INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9);
DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
...@@ -374,5 +374,17 @@ DELETE IGNORE FROM t1; ...@@ -374,5 +374,17 @@ DELETE IGNORE FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug #53450: Crash/assertion
--echo # "virtual int ha_myisam::index_first(uchar*)") at assert.c:81
--echo #
CREATE TABLE t1 (a INT, b INT, c INT,
INDEX(a), INDEX(b), INDEX(c));
INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9);
DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -266,7 +266,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ...@@ -266,7 +266,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
free_underlaid_joins(thd, select_lex); free_underlaid_joins(thd, select_lex);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
if (usable_index==MAX_KEY) if (usable_index==MAX_KEY || (select && select->quick))
init_read_record(&info, thd, table, select, 1, 1, FALSE); init_read_record(&info, thd, table, select, 1, 1, FALSE);
else else
init_read_record_idx(&info, thd, table, 1, usable_index); init_read_record_idx(&info, thd, table, 1, usable_index);
......
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