mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
BUG#9361: Added test cases
mysql-test/r/rpl_multi_update3.result: Added test cases mysql-test/t/rpl_multi_update3.test: Added test cases
This commit is contained in:
@ -4,6 +4,8 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
|
||||
-------- Test for BUG#9361 --------
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
@ -41,3 +43,82 @@ a b
|
||||
1 6
|
||||
2 6
|
||||
drop table t1,t2;
|
||||
|
||||
-------- Test 1 for BUG#9361 --------
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t1 (
|
||||
a1 char(30),
|
||||
a2 int,
|
||||
a3 int,
|
||||
a4 char(30),
|
||||
a5 char(30)
|
||||
);
|
||||
CREATE TABLE t2 (
|
||||
b1 int,
|
||||
b2 char(30)
|
||||
);
|
||||
INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
|
||||
INSERT INTO t2 VALUES (1, 'baz');
|
||||
UPDATE t1 a, t2
|
||||
SET a.a1 = 'No'
|
||||
WHERE a.a2 =
|
||||
(SELECT b1
|
||||
FROM t2
|
||||
WHERE b2 = 'baz')
|
||||
AND a.a3 IS NULL
|
||||
AND a.a4 = 'foo'
|
||||
AND a.a5 = 'bar';
|
||||
SELECT * FROM t1;
|
||||
a1 a2 a3 a4 a5
|
||||
No 1 NULL foo bar
|
||||
SELECT * FROM t2;
|
||||
b1 b2
|
||||
1 baz
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
-------- Test 2 for BUG#9361 --------
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
CREATE TABLE t1 (
|
||||
i INT,
|
||||
j INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
CREATE TABLE t2 (
|
||||
i INT,
|
||||
k INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
CREATE TABLE t3 (
|
||||
j INT,
|
||||
k INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
INSERT INTO t1 VALUES ( 1, 2,13,14,15);
|
||||
INSERT INTO t2 VALUES ( 1, 3,23,24,25);
|
||||
INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
|
||||
UPDATE t1 AS a
|
||||
INNER JOIN t2 AS b
|
||||
ON a.i = b.i
|
||||
INNER JOIN t3 AS c
|
||||
ON a.j = c.j AND b.k = c.k
|
||||
SET a.x = b.x,
|
||||
a.y = b.y,
|
||||
a.z = (
|
||||
SELECT sum(z)
|
||||
FROM t3
|
||||
WHERE y = 34
|
||||
)
|
||||
WHERE b.x = 23;
|
||||
SELECT * FROM t1;
|
||||
i j x y z
|
||||
1 2 23 24 71
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
Reference in New Issue
Block a user