forked from stoneatom/stonedb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tianmu)Fix delete from Multiple-Table, Failed to delete the data (s…
…toneatom#663)(stoneatom#678) Cause: At present, the primary key of the tianmu engine does not fully support delete and update statements. Temporary solution: Modify the execution plan of the SQL layer so that the delete and update statements do not follow the primary key logic
- Loading branch information
Showing
4 changed files
with
81 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# | ||
# Fix delete from Multiple-Table, Failed to delete the data #663,#678 | ||
# | ||
create table t11 (a int NOT NULL, b int, primary key (a))ENGINE=TIANMU; | ||
create table t12 (a int NOT NULL, b int, primary key (a))ENGINE=TIANMU; | ||
insert into t11 values (0, 10),(1, 11),(2, 12); | ||
insert into t12 values (33, 10),(0, 11),(2, 12); | ||
select t11.*,t12.* from t11,t12 where t11.a = t12.a; | ||
a b a b | ||
0 10 0 11 | ||
2 12 2 12 | ||
delete t11.*,t12.* from t11,t12 where t11.a = t12.a; | ||
select * from t11; | ||
a b | ||
1 11 | ||
select * from t12; | ||
a b | ||
33 10 | ||
drop table t11,t12; | ||
CREATE TABLE t1 (a int not null,b int not null)ENGINE=TIANMU; | ||
CREATE TABLE t2 (a int not null, b int not null, primary key (a,b))ENGINE=TIANMU; | ||
CREATE TABLE t3 (a int not null, b int not null, primary key (a,b))ENGINE=TIANMU; | ||
insert into t1 values (1,1),(2,1),(1,3); | ||
insert into t2 values (1,1),(2,2),(3,3); | ||
insert into t3 values (1,1),(2,1),(1,3); | ||
delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b; | ||
select * from t1; | ||
a b | ||
1 1 | ||
2 1 | ||
1 3 | ||
select * from t2; | ||
a b | ||
3 3 | ||
select * from t3; | ||
a b | ||
drop table t1,t2,t3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--source include/have_tianmu.inc | ||
|
||
--echo # | ||
--echo # Fix delete from Multiple-Table, Failed to delete the data #663,#678 | ||
--echo # | ||
|
||
create table t11 (a int NOT NULL, b int, primary key (a))ENGINE=TIANMU; | ||
create table t12 (a int NOT NULL, b int, primary key (a))ENGINE=TIANMU; | ||
insert into t11 values (0, 10),(1, 11),(2, 12); | ||
insert into t12 values (33, 10),(0, 11),(2, 12); | ||
|
||
select t11.*,t12.* from t11,t12 where t11.a = t12.a; | ||
delete t11.*,t12.* from t11,t12 where t11.a = t12.a; | ||
|
||
select * from t11; | ||
select * from t12; | ||
|
||
drop table t11,t12; | ||
|
||
CREATE TABLE t1 (a int not null,b int not null)ENGINE=TIANMU; | ||
CREATE TABLE t2 (a int not null, b int not null, primary key (a,b))ENGINE=TIANMU; | ||
CREATE TABLE t3 (a int not null, b int not null, primary key (a,b))ENGINE=TIANMU; | ||
insert into t1 values (1,1),(2,1),(1,3); | ||
insert into t2 values (1,1),(2,2),(3,3); | ||
insert into t3 values (1,1),(2,1),(1,3); | ||
delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b; | ||
|
||
select * from t1; | ||
select * from t2; | ||
select * from t3; | ||
|
||
drop table t1,t2,t3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters