summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorlars@mysql.com <>2005-10-10 17:50:19 +0200
committerlars@mysql.com <>2005-10-10 17:50:19 +0200
commit57f36732ca48879ae55e44fc8d7142d28f5db4d2 (patch)
treefd4a87cd1abf7aaf02b3656de8317b4dd4d9453e /mysql-test
parent0b8098249726175fb6b84bf457e4720cd504cde6 (diff)
parent998380521fa2d3d249a0c160c09dba61e1898b1f (diff)
downloadmariadb-git-57f36732ca48879ae55e44fc8d7142d28f5db4d2.tar.gz
Merge mysql.com:/users/lthalmann/bkroot/mysql-4.1
into mysql.com:/users/lthalmann/bk/mysql-5.0
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/rpl_multi_update3.result72
-rw-r--r--mysql-test/r/subselect2.result1
-rw-r--r--mysql-test/t/rpl_multi_update3.test59
-rw-r--r--mysql-test/t/select.test4
-rw-r--r--mysql-test/t/subselect2.test2
5 files changed, 138 insertions, 0 deletions
diff --git a/mysql-test/r/rpl_multi_update3.result b/mysql-test/r/rpl_multi_update3.result
index 1b757b1400c..b81af7c6e39 100644
--- a/mysql-test/r/rpl_multi_update3.result
+++ b/mysql-test/r/rpl_multi_update3.result
@@ -122,3 +122,75 @@ SELECT * FROM t1;
i j x y z
1 2 23 24 71
DROP TABLE t1, t2, t3;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+DROP TABLE IF EXISTS t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TABLE t1 (
+idp int(11) NOT NULL default '0',
+idpro int(11) default NULL,
+price decimal(19,4) default NULL,
+PRIMARY KEY (idp)
+);
+CREATE TABLE t2 (
+idpro int(11) NOT NULL default '0',
+price decimal(19,4) default NULL,
+nbprice int(11) default NULL,
+PRIMARY KEY (idpro)
+);
+INSERT INTO t1 VALUES
+(1,1,'3.0000'),
+(2,2,'1.0000'),
+(3,1,'1.0000'),
+(4,1,'4.0000'),
+(5,3,'2.0000'),
+(6,2,'4.0000');
+INSERT INTO t2 VALUES
+(1,'0.0000',0),
+(2,'0.0000',0),
+(3,'0.0000',0);
+update
+t2
+join
+( select idpro, min(price) as min_price, count(*) as nbr_price
+from t1
+where idpro>0 and price>0
+group by idpro
+) as table_price
+on t2.idpro = table_price.idpro
+set t2.price = table_price.min_price,
+t2.nbprice = table_price.nbr_price;
+select "-- MASTER AFTER JOIN --" as "";
+
+-- MASTER AFTER JOIN --
+select * from t1;
+idp idpro price
+1 1 3.0000
+2 2 1.0000
+3 1 1.0000
+4 1 4.0000
+5 3 2.0000
+6 2 4.0000
+select * from t2;
+idpro price nbprice
+1 1.0000 3
+2 1.0000 2
+3 2.0000 1
+select "-- SLAVE AFTER JOIN --" as "";
+
+-- SLAVE AFTER JOIN --
+select * from t1;
+idp idpro price
+1 1 3.0000
+2 2 1.0000
+3 1 1.0000
+4 1 4.0000
+5 3 2.0000
+6 2 4.0000
+select * from t2;
+idpro price nbprice
+1 1.0000 3
+2 1.0000 2
+3 2.0000 1
diff --git a/mysql-test/r/subselect2.result b/mysql-test/r/subselect2.result
index bc902ea7b0f..19047725528 100644
--- a/mysql-test/r/subselect2.result
+++ b/mysql-test/r/subselect2.result
@@ -14,6 +14,7 @@ DOCID VARCHAR(32)BINARY NOT NULL
, PRIMARY KEY ( DOCID )
) ENGINE=InnoDB
;
+INSERT INTO t1 (DOCID) VALUES ("1"), ("2");
CREATE TABLE t2
(
DOCID VARCHAR(32)BINARY NOT NULL
diff --git a/mysql-test/t/rpl_multi_update3.test b/mysql-test/t/rpl_multi_update3.test
index 64e46882c16..36ac7a59cb3 100644
--- a/mysql-test/t/rpl_multi_update3.test
+++ b/mysql-test/t/rpl_multi_update3.test
@@ -158,4 +158,63 @@ SELECT * FROM t1;
connection master;
DROP TABLE t1, t2, t3;
+##############################################################################
+#
+# BUG#12618
+#
+# TEST: Replication of a statement containing a join in a multi-update.
+
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+
+CREATE TABLE t1 (
+ idp int(11) NOT NULL default '0',
+ idpro int(11) default NULL,
+ price decimal(19,4) default NULL,
+ PRIMARY KEY (idp)
+);
+
+CREATE TABLE t2 (
+ idpro int(11) NOT NULL default '0',
+ price decimal(19,4) default NULL,
+ nbprice int(11) default NULL,
+ PRIMARY KEY (idpro)
+);
+
+INSERT INTO t1 VALUES
+ (1,1,'3.0000'),
+ (2,2,'1.0000'),
+ (3,1,'1.0000'),
+ (4,1,'4.0000'),
+ (5,3,'2.0000'),
+ (6,2,'4.0000');
+
+INSERT INTO t2 VALUES
+ (1,'0.0000',0),
+ (2,'0.0000',0),
+ (3,'0.0000',0);
+
+# This update sets t2 to the minimal prices for each product
+update
+ t2
+ join
+ ( select idpro, min(price) as min_price, count(*) as nbr_price
+ from t1
+ where idpro>0 and price>0
+ group by idpro
+ ) as table_price
+on t2.idpro = table_price.idpro
+set t2.price = table_price.min_price,
+ t2.nbprice = table_price.nbr_price;
+
+select "-- MASTER AFTER JOIN --" as "";
+select * from t1;
+select * from t2;
+
+sync_slave_with_master;
+
+select "-- SLAVE AFTER JOIN --" as "";
+select * from t1;
+select * from t2;
+
# End of 4.1 tests
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index f7de7239292..3bfcce832c1 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2189,6 +2189,10 @@ create table t2(f3 int);
select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,1));
select f1 from t1,t2 where f1=f2 and (f1,NULL) = ((1,1));
select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,NULL));
+insert into t1 values(1,1),(2,null);
+insert into t2 values(2);
+select * from t1,t2 where f1=f3 and (f1,f2) = (2,null);
+select * from t1,t2 where f1=f3 and (f1,f2) <=> (2,null);
drop table t1,t2;
# End of 4.1 tests
diff --git a/mysql-test/t/subselect2.test b/mysql-test/t/subselect2.test
index 839e94206d0..b21eda176b6 100644
--- a/mysql-test/t/subselect2.test
+++ b/mysql-test/t/subselect2.test
@@ -25,6 +25,8 @@ DOCID VARCHAR(32)BINARY NOT NULL
) ENGINE=InnoDB
;
+INSERT INTO t1 (DOCID) VALUES ("1"), ("2");
+
CREATE TABLE t2
(
DOCID VARCHAR(32)BINARY NOT NULL