Skip to content

Delete using outer join can mistakenly delete the row whose handle=0 #31321

@ekexium

Description

@ekexium

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table a (k1 int);
create table b (id int primary key, k1 int);
insert into a(k1) values(3);
insert into b values(2, 2);
insert into b values(0, 0);
delete from a, b using a left join b on a.k1 = b.k1;
select * from b;

2. What did you expect to see? (Required)

2 rows: (0,0) and (2,2), as in MySQL

mysql> select * from b;
+----+------+
| id | k1   |
+----+------+
|  0 |    0 |
|  2 |    2 |
+----+------+

3. What did you see instead (Required)

mysql> select * from b;
+----+------+
| id | k1   |
+----+------+
|  2 |    2 |
+----+------+

4. What is your TiDB version? (Required)

tidb_version(): Release Version: v5.5.0-alpha-21-g722303bca
Edition: Community
Git Commit Hash: 722303b
Git Branch: HEAD
UTC Build Time: 2022-01-04 14:53:04
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

Metadata

Metadata

Assignees

Labels

affects-4.0This bug affects 4.0.x versions.affects-5.0This bug affects 5.0.x versions.affects-5.1This bug affects 5.1.x versions.affects-5.2This bug affects 5.2.x versions.affects-5.3This bug affects 5.3.x versions.affects-5.4This bug affects the 5.4.x(LTS) versions.severity/criticalsig/executionSIG executiontype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions