Debian Codegraph @

mysql-test/suite/rpl/r/rpl_multi_update3.result

raw
1 include/master-slave.inc
2 Warnings:
3 Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4 Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
5 [connection master]
6 call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
7
8 -------- Test for BUG#9361 --------
9 CREATE TABLE t1 (
10 a int unsigned not null auto_increment primary key,
11 b int unsigned
12 ) ENGINE=MyISAM;
13 CREATE TABLE t2 (
14 a int unsigned not null auto_increment primary key,
15 b int unsigned
16 ) ENGINE=MyISAM;
17 INSERT INTO t1 VALUES (NULL, 0);
18 INSERT INTO t1 SELECT NULL, 0 FROM t1;
19 INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
20 SELECT * FROM t1 ORDER BY a;
21 a b
22 1 0
23 2 0
24 SELECT * FROM t2 ORDER BY a;
25 a b
26 1 0
27 2 1
28 SET @optimizer_switch_saved= @@optimizer_switch;
29 SET @@optimizer_switch="derived_merge=off";
30 UPDATE t2, (SELECT a FROM t1 ORDER BY a) AS t SET t2.b = t.a+5 ;
31 SET @@optimizer_switch=@optimizer_switch_saved;
32 SELECT * FROM t1 ORDER BY a;
33 a b
34 1 0
35 2 0
36 SELECT * FROM t2 ORDER BY a;
37 a b
38 1 6
39 2 6
40 include/sync_slave_sql_with_master.inc
41 SELECT * FROM t1 ORDER BY a;
42 a b
43 1 0
44 2 0
45 SELECT * FROM t2 ORDER BY a;
46 a b
47 1 6
48 2 6
49 drop table t1,t2;
50
51 -------- Test 1 for BUG#9361 --------
52 DROP TABLE IF EXISTS t1;
53 DROP TABLE IF EXISTS t2;
54 CREATE TABLE t1 (
55 a1 char(30),
56 a2 int,
57 a3 int,
58 a4 char(30),
59 a5 char(30)
60 );
61 CREATE TABLE t2 (
62 b1 int,
63 b2 char(30)
64 );
65 INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
66 INSERT INTO t2 VALUES (1, 'baz');
67 UPDATE t1 a, t2
68 SET a.a1 = 'No'
69 WHERE a.a2 =
70 (SELECT b1
71 FROM t2
72 WHERE b2 = 'baz')
73 AND a.a3 IS NULL
74 AND a.a4 = 'foo'
75 AND a.a5 = 'bar';
76 include/sync_slave_sql_with_master.inc
77 SELECT * FROM t1;
78 a1 a2 a3 a4 a5
79 No 1 NULL foo bar
80 SELECT * FROM t2;
81 b1 b2
82 1 baz
83 DROP TABLE t1, t2;
84
85 -------- Test 2 for BUG#9361 --------
86 DROP TABLE IF EXISTS t1;
87 DROP TABLE IF EXISTS t2;
88 DROP TABLE IF EXISTS t3;
89 CREATE TABLE t1 (
90 i INT,
91 j INT,
92 x INT,
93 y INT,
94 z INT
95 );
96 CREATE TABLE t2 (
97 i INT,
98 k INT,
99 x INT,
100 y INT,
101 z INT
102 );
103 CREATE TABLE t3 (
104 j INT,
105 k INT,
106 x INT,
107 y INT,
108 z INT
109 );
110 INSERT INTO t1 VALUES ( 1, 2,13,14,15);
111 INSERT INTO t2 VALUES ( 1, 3,23,24,25);
112 INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
113 UPDATE t1 AS a
114 INNER JOIN t2 AS b
115 ON a.i = b.i
116 INNER JOIN t3 AS c
117 ON a.j = c.j AND b.k = c.k
118 SET a.x = b.x,
119 a.y = b.y,
120 a.z = (
121 SELECT sum(z)
122 FROM t3
123 WHERE y = 34
124 )
125 WHERE b.x = 23;
126 include/sync_slave_sql_with_master.inc
127 SELECT * FROM t1;
128 i j x y z
129 1 2 23 24 71
130 DROP TABLE t1, t2, t3;
131 DROP TABLE IF EXISTS t1;
132 Warnings:
133 Note 1051 Unknown table 'test.t1'
134 DROP TABLE IF EXISTS t2;
135 Warnings:
136 Note 1051 Unknown table 'test.t2'
137 CREATE TABLE t1 (
138 idp int(11) NOT NULL default '0',
139 idpro int(11) default NULL,
140 price decimal(19,4) default NULL,
141 PRIMARY KEY (idp)
142 );
143 Warnings:
144 Warning 1681 Integer display width is deprecated and will be removed in a future release.
145 Warning 1681 Integer display width is deprecated and will be removed in a future release.
146 CREATE TABLE t2 (
147 idpro int(11) NOT NULL default '0',
148 price decimal(19,4) default NULL,
149 nbprice int(11) default NULL,
150 PRIMARY KEY (idpro)
151 );
152 Warnings:
153 Warning 1681 Integer display width is deprecated and will be removed in a future release.
154 Warning 1681 Integer display width is deprecated and will be removed in a future release.
155 INSERT INTO t1 VALUES
156 (1,1,'3.0000'),
157 (2,2,'1.0000'),
158 (3,1,'1.0000'),
159 (4,1,'4.0000'),
160 (5,3,'2.0000'),
161 (6,2,'4.0000');
162 INSERT INTO t2 VALUES
163 (1,'0.0000',0),
164 (2,'0.0000',0),
165 (3,'0.0000',0);
166 update
167 t2
168 join
169 ( select idpro, min(price) as min_price, count(*) as nbr_price
170 from t1
171 where idpro>0 and price>0
172 group by idpro
173 ) as table_price
174 on t2.idpro = table_price.idpro
175 set t2.price = table_price.min_price,
176 t2.nbprice = table_price.nbr_price;
177 select "-- MASTER AFTER JOIN --" as "";
178
179 -- MASTER AFTER JOIN --
180 select * from t1;
181 idp idpro price
182 1 1 3.0000
183 2 2 1.0000
184 3 1 1.0000
185 4 1 4.0000
186 5 3 2.0000
187 6 2 4.0000
188 select * from t2;
189 idpro price nbprice
190 1 1.0000 3
191 2 1.0000 2
192 3 2.0000 1
193 include/sync_slave_sql_with_master.inc
194 select "-- SLAVE AFTER JOIN --" as "";
195
196 -- SLAVE AFTER JOIN --
197 select * from t1;
198 idp idpro price
199 1 1 3.0000
200 2 2 1.0000
201 3 1 1.0000
202 4 1 4.0000
203 5 3 2.0000
204 6 2 4.0000
205 select * from t2;
206 idpro price nbprice
207 1 1.0000 3
208 2 1.0000 2
209 3 2.0000 1
210 DROP TABLE t1, t2;
211 include/rpl_end.inc