~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
stop slave;
 
2
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 
3
reset master;
 
4
reset slave;
 
5
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 
6
start slave;
 
7
drop database if exists mysqltest1;
 
8
create database mysqltest1;
 
9
use mysqltest1;
 
10
set @my_binlog_format= @@global.binlog_format;
 
11
set session binlog_format=mixed;
 
12
show session variables like "binlog_format%";
 
13
Variable_name   Value
 
14
binlog_format   MIXED
 
15
set session binlog_format=statement;
 
16
show session variables like "binlog_format%";
 
17
Variable_name   Value
 
18
binlog_format   STATEMENT
 
19
set session binlog_format=row;
 
20
show session variables like "binlog_format%";
 
21
Variable_name   Value
 
22
binlog_format   ROW
 
23
set global binlog_format=DEFAULT;
 
24
show global variables like "binlog_format%";
 
25
Variable_name   Value
 
26
binlog_format   MIXED
 
27
set global binlog_format=MIXED;
 
28
show global variables like "binlog_format%";
 
29
Variable_name   Value
 
30
binlog_format   MIXED
 
31
set global binlog_format=STATEMENT;
 
32
show global variables like "binlog_format%";
 
33
Variable_name   Value
 
34
binlog_format   STATEMENT
 
35
set global binlog_format=ROW;
 
36
show global variables like "binlog_format%";
 
37
Variable_name   Value
 
38
binlog_format   ROW
 
39
show session variables like "binlog_format%";
 
40
Variable_name   Value
 
41
binlog_format   ROW
 
42
select @@global.binlog_format, @@session.binlog_format;
 
43
@@global.binlog_format  @@session.binlog_format
 
44
ROW     ROW
 
45
CREATE TABLE t1 (a varchar(100));
 
46
prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
 
47
set @string="emergency_1_";
 
48
insert into t1 values("work_2_");
 
49
execute stmt1 using @string;
 
50
deallocate prepare stmt1;
 
51
prepare stmt1 from 'insert into t1 select ?';
 
52
insert into t1 values(concat(UUID(),"work_3_"));
 
53
execute stmt1 using @string;
 
54
deallocate prepare stmt1;
 
55
insert into t1 values(concat("for_4_",UUID()));
 
56
insert into t1 select "yesterday_5_";
 
57
create temporary table tmp(a char(100));
 
58
insert into tmp values("see_6_");
 
59
set binlog_format=statement;
 
60
ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables
 
61
insert into t1 select * from tmp;
 
62
drop temporary table tmp;
 
63
set binlog_format=statement;
 
64
show global variables like "binlog_format%";
 
65
Variable_name   Value
 
66
binlog_format   ROW
 
67
show session variables like "binlog_format%";
 
68
Variable_name   Value
 
69
binlog_format   STATEMENT
 
70
select @@global.binlog_format, @@session.binlog_format;
 
71
@@global.binlog_format  @@session.binlog_format
 
72
ROW     STATEMENT
 
73
set global binlog_format=statement;
 
74
show global variables like "binlog_format%";
 
75
Variable_name   Value
 
76
binlog_format   STATEMENT
 
77
show session variables like "binlog_format%";
 
78
Variable_name   Value
 
79
binlog_format   STATEMENT
 
80
select @@global.binlog_format, @@session.binlog_format;
 
81
@@global.binlog_format  @@session.binlog_format
 
82
STATEMENT       STATEMENT
 
83
prepare stmt1 from 'insert into t1 select ?';
 
84
set @string="emergency_7_";
 
85
insert into t1 values("work_8_");
 
86
execute stmt1 using @string;
 
87
deallocate prepare stmt1;
 
88
prepare stmt1 from 'insert into t1 select ?';
 
89
insert into t1 values("work_9_");
 
90
execute stmt1 using @string;
 
91
deallocate prepare stmt1;
 
92
insert into t1 values("for_10_");
 
93
insert into t1 select "yesterday_11_";
 
94
set binlog_format=statement;
 
95
select @@global.binlog_format, @@session.binlog_format;
 
96
@@global.binlog_format  @@session.binlog_format
 
97
STATEMENT       STATEMENT
 
98
set global binlog_format=statement;
 
99
select @@global.binlog_format, @@session.binlog_format;
 
100
@@global.binlog_format  @@session.binlog_format
 
101
STATEMENT       STATEMENT
 
102
prepare stmt1 from 'insert into t1 select ?';
 
103
set @string="emergency_12_";
 
104
insert into t1 values("work_13_");
 
105
execute stmt1 using @string;
 
106
deallocate prepare stmt1;
 
107
prepare stmt1 from 'insert into t1 select ?';
 
108
insert into t1 values("work_14_");
 
109
execute stmt1 using @string;
 
110
deallocate prepare stmt1;
 
111
insert into t1 values("for_15_");
 
112
insert into t1 select "yesterday_16_";
 
113
set global binlog_format=mixed;
 
114
select @@global.binlog_format, @@session.binlog_format;
 
115
@@global.binlog_format  @@session.binlog_format
 
116
MIXED   STATEMENT
 
117
set binlog_format=default;
 
118
select @@global.binlog_format, @@session.binlog_format;
 
119
@@global.binlog_format  @@session.binlog_format
 
120
MIXED   MIXED
 
121
prepare stmt1 from 'insert into t1 select concat(UUID(),?)';
 
122
set @string="emergency_17_";
 
123
insert into t1 values("work_18_");
 
124
execute stmt1 using @string;
 
125
deallocate prepare stmt1;
 
126
prepare stmt1 from 'insert into t1 select ?';
 
127
insert into t1 values(concat(UUID(),"work_19_"));
 
128
execute stmt1 using @string;
 
129
deallocate prepare stmt1;
 
130
insert into t1 values(concat("for_20_",UUID()));
 
131
insert into t1 select "yesterday_21_";
 
132
prepare stmt1 from 'insert into t1 select ?';
 
133
insert into t1 values(concat(UUID(),"work_22_"));
 
134
execute stmt1 using @string;
 
135
deallocate prepare stmt1;
 
136
insert into t1 values(concat("for_23_",UUID()));
 
137
insert into t1 select "yesterday_24_";
 
138
create table t2 select rpad(UUID(),100,' ');
 
139
create table t3 select 1 union select UUID();
 
140
create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
 
141
create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
 
142
insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
 
143
create procedure foo()
 
144
begin
 
145
insert into t1 values("work_25_");
 
146
insert into t1 values(concat("for_26_",UUID()));
 
147
insert into t1 select "yesterday_27_";
 
148
end|
 
149
create procedure foo2()
 
150
begin
 
151
insert into t1 values(concat("emergency_28_",UUID()));
 
152
insert into t1 values("work_29_");
 
153
insert into t1 values(concat("for_30_",UUID()));
 
154
set session binlog_format=row; # accepted for stored procs
 
155
insert into t1 values("more work_31_");
 
156
set session binlog_format=mixed;
 
157
end|
 
158
create function foo3() returns bigint unsigned
 
159
begin
 
160
set session binlog_format=row; # rejected for stored funcs
 
161
insert into t1 values("alarm");
 
162
return 100;
 
163
end|
 
164
create procedure foo4(x varchar(100))
 
165
begin
 
166
insert into t1 values(concat("work_250_",x));
 
167
insert into t1 select "yesterday_270_";
 
168
end|
 
169
call foo();
 
170
call foo2();
 
171
call foo4("hello");
 
172
call foo4(UUID());
 
173
call foo4("world");
 
174
select foo3();
 
175
ERROR HY000: Cannot change the binary logging format inside a stored function or trigger
 
176
select * from t1 where a="alarm";
 
177
a
 
178
drop function foo3;
 
179
create function foo3() returns bigint unsigned
 
180
begin
 
181
insert into t1 values("foo3_32_");
 
182
call foo();
 
183
return 100;
 
184
end|
 
185
insert into t2 select foo3();
 
186
prepare stmt1 from 'insert into t2 select foo3()';
 
187
execute stmt1;
 
188
execute stmt1;
 
189
deallocate prepare stmt1;
 
190
create function foo4() returns bigint unsigned
 
191
begin
 
192
insert into t2 select foo3();
 
193
return 100;
 
194
end|
 
195
select foo4();
 
196
foo4()
 
197
100
 
198
prepare stmt1 from 'select foo4()';
 
199
execute stmt1;
 
200
foo4()
 
201
100
 
202
execute stmt1;
 
203
foo4()
 
204
100
 
205
deallocate prepare stmt1;
 
206
create function foo5() returns bigint unsigned
 
207
begin
 
208
insert into t2 select UUID();
 
209
return 100;
 
210
end|
 
211
select foo5();
 
212
foo5()
 
213
100
 
214
prepare stmt1 from 'select foo5()';
 
215
execute stmt1;
 
216
foo5()
 
217
100
 
218
execute stmt1;
 
219
foo5()
 
220
100
 
221
deallocate prepare stmt1;
 
222
create function foo6(x varchar(100)) returns bigint unsigned
 
223
begin
 
224
insert into t2 select x;
 
225
return 100;
 
226
end|
 
227
select foo6("foo6_1_");
 
228
foo6("foo6_1_")
 
229
100
 
230
select foo6(concat("foo6_2_",UUID()));
 
231
foo6(concat("foo6_2_",UUID()))
 
232
100
 
233
prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))';
 
234
execute stmt1;
 
235
foo6(concat("foo6_3_",UUID()))
 
236
100
 
237
execute stmt1;
 
238
foo6(concat("foo6_3_",UUID()))
 
239
100
 
240
deallocate prepare stmt1;
 
241
create view v1 as select uuid();
 
242
create table t11 (data varchar(255));
 
243
insert into t11 select * from v1;
 
244
insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11');
 
245
prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')";
 
246
execute stmt1;
 
247
execute stmt1;
 
248
deallocate prepare stmt1;
 
249
create trigger t11_bi before insert on t11 for each row
 
250
begin
 
251
set NEW.data = concat(NEW.data,UUID());
 
252
end|
 
253
insert into t11 values("try_560_");
 
254
insert delayed into t2 values("delay_1_");
 
255
insert delayed into t2 values(concat("delay_2_",UUID()));
 
256
insert delayed into t2 values("delay_6_");
 
257
insert delayed into t2 values(rand());
 
258
set @a=2.345;
 
259
insert delayed into t2 values(@a);
 
260
create table t20 select * from t1;
 
261
create table t21 select * from t2;
 
262
create table t22 select * from t3;
 
263
drop table t1,t2,t3;
 
264
create table t1 (a int primary key auto_increment, b varchar(100));
 
265
create table t2 (a int primary key auto_increment, b varchar(100));
 
266
create table t3 (b varchar(100));
 
267
create function f (x varchar(100)) returns int deterministic
 
268
begin
 
269
insert into t1 values(null,x);
 
270
insert into t2 values(null,x);
 
271
return 1;
 
272
end|
 
273
select f("try_41_");
 
274
f("try_41_")
 
275
1
 
276
use mysqltest1;
 
277
insert into t2 values(2,null),(3,null),(4,null);
 
278
delete from t2 where a>=2;
 
279
select f("try_42_");
 
280
f("try_42_")
 
281
1
 
282
insert into t2 values(3,null),(4,null);
 
283
delete from t2 where a>=3;
 
284
prepare stmt1 from 'select f(?)';
 
285
set @string="try_43_";
 
286
insert into t1 values(null,"try_44_");
 
287
execute stmt1 using @string;
 
288
f(?)
 
289
1
 
290
deallocate prepare stmt1;
 
291
create table t12 select * from t1;
 
292
drop table t1;
 
293
create table t1 (a int, b varchar(100), key(a));
 
294
select f("try_45_");
 
295
f("try_45_")
 
296
1
 
297
create table t13 select * from t1;
 
298
drop table t1;
 
299
create table t1 (a int primary key auto_increment, b varchar(100));
 
300
drop function f;
 
301
create table t14 (unique (a)) select * from t2;
 
302
truncate table t2;
 
303
create function f1 (x varchar(100)) returns int deterministic
 
304
begin
 
305
insert into t1 values(null,x);
 
306
return 1;
 
307
end|
 
308
create function f2 (x varchar(100)) returns int deterministic
 
309
begin
 
310
insert into t2 values(null,x);
 
311
return 1;
 
312
end|
 
313
select f1("try_46_"),f2("try_47_");
 
314
f1("try_46_")   f2("try_47_")
 
315
1       1
 
316
insert into t2 values(2,null),(3,null),(4,null);
 
317
delete from t2 where a>=2;
 
318
select f1("try_48_"),f2("try_49_");
 
319
f1("try_48_")   f2("try_49_")
 
320
1       1
 
321
insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_")));
 
322
drop function f2;
 
323
create function f2 (x varchar(100)) returns int deterministic
 
324
begin
 
325
declare y int;
 
326
insert into t1 values(null,x);
 
327
set y = (select count(*) from t2);
 
328
return y;
 
329
end|
 
330
select f1("try_53_"),f2("try_54_");
 
331
f1("try_53_")   f2("try_54_")
 
332
1       3
 
333
drop function f2;
 
334
create trigger t1_bi before insert on t1 for each row
 
335
begin
 
336
insert into t2 values(null,"try_55_");
 
337
end|
 
338
insert into t1 values(null,"try_56_");
 
339
alter table t1 modify a int, drop primary key;
 
340
insert into t1 values(null,"try_57_");
 
341
CREATE TEMPORARY TABLE t15 SELECT UUID();
 
342
create table t16 like t15;
 
343
INSERT INTO t16 SELECT * FROM t15;
 
344
insert into t16 values("try_65_");
 
345
drop table t15;
 
346
insert into t16 values("try_66_");
 
347
select count(*) from t1;
 
348
count(*)
 
349
7
 
350
select count(*) from t2;
 
351
count(*)
 
352
5
 
353
select count(*) from t3;
 
354
count(*)
 
355
1
 
356
select count(*) from t4;
 
357
count(*)
 
358
29
 
359
select count(*) from t5;
 
360
count(*)
 
361
58
 
362
select count(*) from t11;
 
363
count(*)
 
364
8
 
365
select count(*) from t20;
 
366
count(*)
 
367
66
 
368
select count(*) from t21;
 
369
count(*)
 
370
19
 
371
select count(*) from t22;
 
372
count(*)
 
373
2
 
374
select count(*) from t12;
 
375
count(*)
 
376
4
 
377
select count(*) from t13;
 
378
count(*)
 
379
1
 
380
select count(*) from t14;
 
381
count(*)
 
382
4
 
383
select count(*) from t16;
 
384
count(*)
 
385
3
 
386
DROP TABLE IF EXISTS t11;
 
387
SET SESSION BINLOG_FORMAT=STATEMENT;
 
388
CREATE TABLE t11 (song VARCHAR(255));
 
389
LOCK TABLES t11 WRITE;
 
390
SET SESSION BINLOG_FORMAT=ROW;
 
391
INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict');
 
392
SET SESSION BINLOG_FORMAT=STATEMENT;
 
393
INSERT INTO t11 VALUES('Careful With That Axe, Eugene');
 
394
UNLOCK TABLES;
 
395
SELECT * FROM t11;
 
396
song    Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict
 
397
song    Careful With That Axe, Eugene
 
398
USE mysqltest1;
 
399
SELECT * FROM t11;
 
400
song    Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict
 
401
song    Careful With That Axe, Eugene
 
402
DROP TABLE IF EXISTS t12;
 
403
SET SESSION BINLOG_FORMAT=MIXED;
 
404
CREATE TABLE t12 (data LONG);
 
405
LOCK TABLES t12 WRITE;
 
406
INSERT INTO t12 VALUES(UUID());
 
407
UNLOCK TABLES;
 
408
CREATE FUNCTION my_user()
 
409
RETURNS CHAR(64)
 
410
BEGIN
 
411
DECLARE user CHAR(64);
 
412
SELECT USER() INTO user;
 
413
RETURN user;
 
414
END $$
 
415
CREATE FUNCTION my_current_user()
 
416
RETURNS CHAR(64)
 
417
BEGIN
 
418
DECLARE user CHAR(64);
 
419
SELECT CURRENT_USER() INTO user;
 
420
RETURN user;
 
421
END $$
 
422
DROP TABLE IF EXISTS t13;
 
423
CREATE TABLE t13 (data CHAR(64));
 
424
INSERT INTO t13 VALUES (USER());
 
425
INSERT INTO t13 VALUES (my_user());
 
426
INSERT INTO t13 VALUES (CURRENT_USER());
 
427
INSERT INTO t13 VALUES (my_current_user());
 
428
drop database mysqltest1;
 
429
set global binlog_format =@my_binlog_format;