Skip to content

no support of syntax delete ignore t1.* #3960

Open
@XuHuaiyu

Description

create table t11 (a int NOT NULL, b int, primary key (a));        
create table t12 (a int NOT NULL, b int, primary key (a));        
create table t2 (a int NOT NULL, b int, primary key (a));             
insert into t11 values (0, 10),(1, 11),(2, 12);    
insert into t12 values (33, 10),(0, 11),(2, 12);    
insert into t2 values (1, 21),(2, 12),(3, 23);      
select * from t11;         
select * from t12; 
select * from t2;

In MySQL:

mysql> delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
ERROR 1242 (21000): Subquery returns more than 1 row

mysql> delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
Query OK, 2 rows affected, 1 warning (0.00 sec)

mysql> select * from t11;
+---+------+
| a | b    |
+---+------+
| 0 |   10 |
| 1 |   11 |
+---+------+
2 rows in set (0.00 sec)

mysql> delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
Query OK, 0 rows affected, 2 warnings (0.01 sec)

In TiDB:

tidb> delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
ERROR 1105 (HY000): line 0 column 12 near ", t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a)" (total length 103)

tidb> delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
ERROR 1105 (HY000): line 0 column 19 near ", t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a)" (total length 110)

tidb> select * from t11;
+---+------+
| a | b    |
+---+------+
| 0 |   10 |
| 1 |   11 |
| 2 |   12 |
+---+------+
3 rows in set (0.00 sec)

tidb> delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
ERROR 1105 (HY000): subquery returns more than 1 row
  1. What version of TiDB are you using (tidb-server -V)?
Git Commit Hash: 58dca67d6e576a50d45ce0dbd348ae485128e015
UTC Build Time: 2017-07-31 02:37:29

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions