1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
--source include/have_binlog_format_statement.inc
--disable_query_log
reset master; # get rid of previous tests binlog
--enable_query_log
--echo #
--echo # MDEV-11815 SP variables of temporal data types do not replicate correctly
--echo #
CREATE TABLE t1(a INT);
DELIMITER $$;
CREATE PROCEDURE p1()
BEGIN
DECLARE i INT DEFAULT 123;
DECLARE b8 BIT(8) DEFAULT 0x61;
DECLARE t0 TIME DEFAULT '01:01:01';
DECLARE t6 TIME(6) DEFAULT '01:01:01.123456';
DECLARE d DATE DEFAULT '2001-01-01';
DECLARE dt0 DATETIME DEFAULT '2001-01-01 01:01:01';
DECLARE dt6 DATETIME(6) DEFAULT '2001-01-01 01:01:01.123456';
DECLARE ts0 TIMESTAMP DEFAULT '2001-01-01 01:01:01';
DECLARE ts6 TIMESTAMP(6) DEFAULT '2001-01-01 01:01:01.123456';
INSERT INTO t1 VALUES (i=0x61);
INSERT INTO t1 VALUES (b8=0x61);
INSERT INTO t1 VALUES (t0=10101);
INSERT INTO t1 VALUES (t6=10101);
INSERT INTO t1 VALUES (d=20010101);
INSERT INTO t1 VALUES (dt0=20010101010101);
INSERT INTO t1 VALUES (dt6=20010101010101);
INSERT INTO t1 VALUES (ts0=20010101010101);
INSERT INTO t1 VALUES (ts6=20010101010101);
END;
$$
DELIMITER ;$$
CALL p1;
DROP TABLE t1;
DROP PROCEDURE p1;
--let $binlog_file = LAST
source include/show_binlog_events.inc;
--echo #
--echo # MDEV-16020 SP variables inside GROUP BY..WITH ROLLUP break replication
--echo #
FLUSH LOGS;
CREATE TABLE t1 (d DATE);
INSERT INTO t1 VALUES ('1985-05-13'),('1989-12-24');
CREATE TABLE t2 (d DATE, c BIGINT);
DELIMITER $$;
BEGIN NOT ATOMIC
BEGIN
DECLARE var INT DEFAULT 10;
INSERT INTO t2 SELECT d, COUNT(*) FROM t1 GROUP BY d, var;
INSERT INTO t2 SELECT d, COUNT(*) FROM t1 GROUP BY d, var WITH ROLLUP;
END;
BEGIN
DECLARE atomic INT DEFAULT 20;
INSERT INTO t2 SELECT d, COUNT(*) FROM t1 GROUP BY d, atomic;
INSERT INTO t2 SELECT d, COUNT(*) FROM t1 GROUP BY d, atomic WITH ROLLUP;
INSERT INTO t2 SELECT d, COUNT(*) FROM t1 GROUP BY d, `atomic`;
INSERT INTO t2 SELECT d, COUNT(*) FROM t1 GROUP BY d, `atomic` WITH ROLLUP;
END;
BEGIN
DECLARE atomic ROW (atomic INT, xxx INT) DEFAULT (31,32);
INSERT INTO t2 SELECT d, COUNT(*) FROM t1 GROUP BY d, atomic.atomic;
INSERT INTO t2 SELECT d, COUNT(*) FROM t1 GROUP BY d, atomic.atomic WITH ROLLUP;
INSERT INTO t2 SELECT d, COUNT(*) FROM t1 GROUP BY d, `atomic`.`atomic`;
INSERT INTO t2 SELECT d, COUNT(*) FROM t1 GROUP BY d, `atomic`.`atomic` WITH ROLLUP;
INSERT INTO t2 SELECT d, COUNT(*) FROM t1 GROUP BY d, atomic.xxx;
INSERT INTO t2 SELECT d, COUNT(*) FROM t1 GROUP BY d, atomic.xxx WITH ROLLUP;
INSERT INTO t2 SELECT d, COUNT(*) FROM t1 GROUP BY d, `atomic`.`xxx`;
INSERT INTO t2 SELECT d, COUNT(*) FROM t1 GROUP BY d, `atomic`.`xxx` WITH ROLLUP;
END;
END;
$$
DELIMITER ;$$
DROP TABLE t1,t2;
--let $binlog_file = LAST
source include/show_binlog_events.inc;
|