1-- source include/have_binlog_format_statement.inc
2RESET MASTER;
3#
4# BUG#49562: SBR out of sync when using numeric data types + user variable
5#
6
7-- let $max_unsigned_long= 18446744073709551615
8-- let $min_signed_long= -9223372036854775808
9-- eval SET @positive= $max_unsigned_long
10-- eval SET @negative= $min_signed_long
11
12CREATE TABLE t1 (`tinyint` TINYINT,
13                 `smallint` SMALLINT,
14                 `mediumint` MEDIUMINT,
15                 `integer` INTEGER,
16                 `bigint` BIGINT,
17                 `utinyint` TINYINT UNSIGNED,
18                 `usmallint` SMALLINT UNSIGNED,
19                 `umediumint` MEDIUMINT UNSIGNED,
20                 `uinteger` INTEGER UNSIGNED,
21                 `ubigint` BIGINT UNSIGNED,
22                 `double` DOUBLE,
23                 `float` FLOAT,
24                 `real` REAL(30,2),
25                 `decimal` DECIMAL(30,2)) ENGINE = MyISAM;
26
27-- echo ### insert max unsigned
28-- echo ### a) declarative
29-- disable_warnings
30-- eval INSERT IGNORE INTO t1 VALUES ($max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long,$max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long, $max_unsigned_long);
31-- enable_warnings
32TRUNCATE t1;
33
34-- echo ### b) user var
35-- disable_warnings
36INSERT IGNORE INTO t1 VALUES (@positive,
37                       @positive,
38                       @positive,
39                       @positive,
40                       @positive,
41                       @positive,
42                       @positive,
43                       @positive,
44                       @positive,
45                       @positive,
46                       @positive,
47                       @positive,
48                       @positive,
49                       @positive);
50-- enable_warnings
51
52-- echo ## assertion: checks that User_var_log_event::pack_info
53-- echo ## correctly displays the binlog content by taking into
54-- echo ## account the unsigned_flag
55-- source include/show_binlog_events.inc
56
57-- echo ### insert min signed
58-- echo ### a) declarative
59-- disable_warnings
60-- eval INSERT IGNORE INTO t1 VALUES ($min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long,$min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long, $min_signed_long);
61-- enable_warnings
62TRUNCATE t1;
63
64-- echo ### b) user var
65-- disable_warnings
66INSERT IGNORE INTO t1 VALUES (@negative,
67                       @negative,
68                       @negative,
69                       @negative,
70                       @negative,
71                       @negative,
72                       @negative,
73                       @negative,
74                       @negative,
75                       @negative,
76                       @negative,
77                       @negative,
78                       @negative,
79                       @negative);
80-- enable_warnings
81
82-- echo ## assertion: checks that User_var_log_event::pack_info
83-- echo ## correctly displays the binlog content by taking into
84-- echo ## account the unsigned_flag
85-- source include/show_binlog_events.inc
86
87DROP TABLE t1;
88