| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# This test checks that mysqlbinlog reads and prints the correct numeric |
| 4 |
# signedness metadata when using '--print-table-metadata' |
| 5 |
# It also shows that the type YEAR is not shown as UNSIGNED |
| 6 |
# |
| 7 |
# ==== Requirements ==== |
| 8 |
# |
| 9 |
# + TC1: Fields should be correctly marked as signed or unsigned. |
| 10 |
# |
| 11 |
# ==== Implementation ==== |
| 12 |
# |
| 13 |
# 1. Create a table with a signed and unsigned column. |
| 14 |
# Get the binlog in use and flush logs |
| 15 |
# 2. Execute mysqlbinlog with '--print-table-metadata' |
| 16 |
# Check column metadata correctly reports what columns are signed or not |
| 17 |
# 3. Cleanup |
| 18 |
# |
| 19 |
# ==== References ==== |
| 20 |
# |
| 21 |
# Bug#31956206: MYSQLBINLOG READS THE WRONG METADATA FOR NUMERIC FIELDS. |
| 22 |
# |
| 23 |
|
| 24 |
# This test checks table map events |
| 25 |
-- source include/have_binlog_format_row.inc |
| 26 |
|
| 27 |
--echo |
| 28 |
--echo # 1.Create a table with a signed and unsigned column. |
| 29 |
--echo # Get the binlog in use and flush logs |
| 30 |
|
| 31 |
CREATE TABLE `t1` ( |
| 32 |
`col_key` CHAR(255) DEFAULT "", |
| 33 |
`col_year_key` YEAR DEFAULT NULL, |
| 34 |
`col_float_key` FLOAT UNSIGNED, |
| 35 |
`col_bigint_key` BIGINT DEFAULT NULL, |
| 36 |
PRIMARY KEY (`col_key`) |
| 37 |
) ENGINE=InnoDB; |
| 38 |
|
| 39 |
INSERT INTO t1 VALUES ('key', '1985', 1.7, 23); |
| 40 |
|
| 41 |
let $MYSQLD_DATADIR=`select @@datadir`; |
| 42 |
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); |
| 43 |
|
| 44 |
FLUSH LOGS; |
| 45 |
|
| 46 |
--echo |
| 47 |
--echo # 2. Execute mysqlbinlog with '--print-table-metadata' |
| 48 |
--echo # Check column metadata correctly reports what columns are signed or not |
| 49 |
--echo # YEAR is considered unsigned, but not shown as such |
| 50 |
|
| 51 |
--exec $MYSQL_BINLOG --print-table-metadata $MYSQLD_DATADIR/$binlog_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_signed_metata.output |
| 52 |
|
| 53 |
--let $assert_text= Check the YEAR metadata is marked signed and therefore, omitted info about signedness |
| 54 |
--let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_signed_metata.output |
| 55 |
--let $assert_select = # YEAR, |
| 56 |
--let $assert_count = 1 |
| 57 |
--source include/assert_grep.inc |
| 58 |
|
| 59 |
--let $assert_text= Check that FLOAT metadata is marked as unsigned |
| 60 |
--let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_signed_metata.output |
| 61 |
--let $assert_select = # FLOAT UNSIGNED, |
| 62 |
--let $assert_count = 1 |
| 63 |
--source include/assert_grep.inc |
| 64 |
|
| 65 |
--let $assert_text= Check that BIGINT metadata is marked signed and therefore, omitted info about signedness |
| 66 |
--let $assert_file = $MYSQLTEST_VARDIR/tmp/mysqlbinlog_signed_metata.output |
| 67 |
--let $assert_select = # BIGINT\) |
| 68 |
--let $assert_count = 1 |
| 69 |
--source include/assert_grep.inc |
| 70 |
|
| 71 |
--echo |
| 72 |
--echo # 3. Cleanup |
| 73 |
|
| 74 |
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_signed_metata.output |
| 75 |
|
| 76 |
DROP TABLE t1; |
| 77 |
|
| 78 |
RESET MASTER; |