diff options
author | ram@gw.mysql.r18.ru <> | 2004-10-06 12:49:56 +0500 |
---|---|---|
committer | ram@gw.mysql.r18.ru <> | 2004-10-06 12:49:56 +0500 |
commit | 0944bed7fcb59fb38230a750bd820a22b3b6b476 (patch) | |
tree | 0535bd32f3125c03c099324bb261b9a5c9924a56 | |
parent | 992b04d3d8073a933b3c0e1ab229edaf52ab5df6 (diff) | |
parent | 4ec50dc4d7b216489eda1da5d0053dad30fd738f (diff) | |
download | mariadb-git-0944bed7fcb59fb38230a750bd820a22b3b6b476.tar.gz |
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.0
into gw.mysql.r18.ru:/usr/home/ram/work/4.0.b5733
-rw-r--r-- | mysql-test/r/delete.result | 11 | ||||
-rw-r--r-- | mysql-test/t/delete.test | 10 | ||||
-rw-r--r-- | sql/records.cc | 27 |
3 files changed, 39 insertions, 9 deletions
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index abc8245e69f..7353e687ae7 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -50,3 +50,14 @@ select count(*) from t1; count(*) 0 drop table t1; +create table t1 (a int not null auto_increment primary key, b char(32)); +insert into t1 (b) values ('apple'), ('apple'); +select * from t1; +a b +1 apple +2 apple +delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a; +select * from t1; +a b +1 apple +drop table t1; diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index 904d959d148..07cb9155b3f 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -61,3 +61,13 @@ select count(*) from t1; drop table t1; +# +# Bug #5733: Table handler error with self-join multi-table DELETE +# + +create table t1 (a int not null auto_increment primary key, b char(32)); +insert into t1 (b) values ('apple'), ('apple'); +select * from t1; +delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a; +select * from t1; +drop table t1; diff --git a/sql/records.cc b/sql/records.cc index 7cbb1ab3205..98aede52416 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -131,17 +131,26 @@ void end_read_record(READ_RECORD *info) static int rr_quick(READ_RECORD *info) { - int tmp=info->select->quick->get_next(); - if (tmp) + int tmp; + while ((tmp= info->select->quick->get_next())) { - if (tmp == HA_ERR_END_OF_FILE) - tmp= -1; - else + if (info->thd->killed) { - if (info->print_error) - info->file->print_error(tmp,MYF(0)); - if (tmp < 0) // Fix negative BDB errno - tmp=1; + my_error(ER_SERVER_SHUTDOWN, MYF(0)); + return 1; + } + if (tmp != HA_ERR_RECORD_DELETED) + { + if (tmp == HA_ERR_END_OF_FILE) + tmp= -1; + else + { + if (info->print_error) + info->file->print_error(tmp,MYF(0)); + if (tmp < 0) // Fix negative BDB errno + tmp=1; + } + break; } } return tmp; |