Skip to content

Commit

Permalink
test(mtr):add delete_join.test and modified issue515.test(#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidshiz authored and mergify[bot] committed Oct 25, 2022
1 parent 30b7fc1 commit 35e7800
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
49 changes: 49 additions & 0 deletions mysql-test/suite/tianmu/r/delete_join.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# DELETE JOIN
#
DROP DATABASE IF EXISTS delete_join_test;
CREATE DATABASE delete_join_test;
USE delete_join_test;
CREATE TABLE t1 (t1_int INT, t1_char CHAR(5));
CREATE TABLE t2 (t2_int INT, t2_char CHAR(5));
INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'bbb'),(3, 'ccc'),(4, 'ddd'),(5, 'aa'),(6, ''),(7, 'aaaaa');
INSERT INTO t2 VALUES (NULL, ''),(1, 'hhhh'),(3, 'iii'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'm'),(11, 'nnn');
SELECT * FROM t1 ORDER BY t1_int;
t1_int t1_char
NULL
1 aaa
2 bbb
3 ccc
4 ddd
5 aa
6
7 aaaaa
SELECT * FROM t2 ORDER BY t2_int;
t2_int t2_char
NULL
1 hhhh
3 iii
5 jjj
6
7 lll
9 m
11 nnn
DELETE t1 FROM t1 INNER JOIN t2 ON t1.t1_int=t2.t2_int AND t1.t1_char LIKE '%a%';
SELECT * FROM t1 ORDER BY t1_int;
t1_int t1_char
NULL
2 bbb
3 ccc
4 ddd
6
DELETE t2 FROM t2 LEFT JOIN t1 ON t1.t1_int=t2.t2_int WHERE t2.t2_int IS NULL;
SELECT * FROM t2 ORDER BY t2_int;
t2_int t2_char
1 hhhh
3 iii
5 jjj
6
7 lll
9 m
11 nnn
DROP DATABASE delete_join_test;
28 changes: 28 additions & 0 deletions mysql-test/suite/tianmu/t/delete_join.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--source include/have_tianmu.inc

--echo #
--echo # DELETE JOIN
--echo #

--disable_warnings
DROP DATABASE IF EXISTS delete_join_test;
--enable_warnings

CREATE DATABASE delete_join_test;
USE delete_join_test;

CREATE TABLE t1 (t1_int INT, t1_char CHAR(5));
CREATE TABLE t2 (t2_int INT, t2_char CHAR(5));
INSERT INTO t1 VALUES (NULL, ''),(1, 'aaa'),(2, 'bbb'),(3, 'ccc'),(4, 'ddd'),(5, 'aa'),(6, ''),(7, 'aaaaa');
INSERT INTO t2 VALUES (NULL, ''),(1, 'hhhh'),(3, 'iii'),(5, 'jjj'),(6, ''),(7, 'lll'),(9, 'm'),(11, 'nnn');

SELECT * FROM t1 ORDER BY t1_int;
SELECT * FROM t2 ORDER BY t2_int;

DELETE t1 FROM t1 INNER JOIN t2 ON t1.t1_int=t2.t2_int AND t1.t1_char LIKE '%a%';
SELECT * FROM t1 ORDER BY t1_int;
DELETE t2 FROM t2 LEFT JOIN t1 ON t1.t1_int=t2.t2_int WHERE t2.t2_int IS NULL;
SELECT * FROM t2 ORDER BY t2_int;

# Clean UP
DROP DATABASE delete_join_test;
File renamed without changes.

0 comments on commit 35e7800

Please sign in to comment.