Skip to content

Commit 9da8a8f

Browse files
author
Alexander Barkov
committed
MDEV-7269 mysqlbinlog Don't know how to handle column type=0 meta=0 (0000)#
MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
1 parent a8b8544 commit 9da8a8f

File tree

9 files changed

+130
-2
lines changed

9 files changed

+130
-2
lines changed

mysql-test/r/type_decimal.result

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,3 +994,24 @@ GROUP BY t2.col0
994994
WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL));
995995
1
996996
DROP TABLE t1, t2;
997+
#
998+
# Start of 5.5 tests
999+
#
1000+
#
1001+
# MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
1002+
#
1003+
SHOW CREATE TABLE t1dec102;
1004+
Table Create Table
1005+
t1dec102 CREATE TABLE `t1dec102` (
1006+
`a` decimal(10,2)/*old*/ DEFAULT NULL
1007+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1008+
SHOW COLUMNS FROM t1dec102;
1009+
Field Type Null Key Default Extra
1010+
a decimal(10,2)/*old*/ YES NULL
1011+
SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
1012+
COLUMN_NAME DATA_TYPE COLUMN_TYPE
1013+
a decimal decimal(10,2)/*old*/
1014+
DROP TABLE t1dec102;
1015+
#
1016+
# End of 5.5 tests
1017+
#
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
� 123.45� 123.46� 123.47
Binary file not shown.
8.35 KB
Binary file not shown.

mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,18 @@ INSERT INTO t2 SET a=1;
327327
INSERT INTO t2 SET b=1;
328328
UPDATE t1, t2 SET t1.a=10, t2.a=20;
329329
DROP TABLE t1,t2;
330+
INSERT INTO t1dec102 VALUES (-999.99);
331+
INSERT INTO t1dec102 VALUES (0);
332+
INSERT INTO t1dec102 VALUES (999.99);
333+
SELECT * FROM t1dec102 ORDER BY a;
334+
a
335+
-999.99
336+
0.00
337+
123.45
338+
123.46
339+
123.47
340+
999.99
341+
DROP TABLE t1dec102;
330342
flush logs;
331343
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
332344
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
@@ -4131,6 +4143,59 @@ SET TIMESTAMP=1000000000/*!*/;
41314143
DROP TABLE `t1`,`t2` /* generated by server */
41324144
/*!*/;
41334145
# at #
4146+
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
4147+
SET TIMESTAMP=1000000000/*!*/;
4148+
BEGIN
4149+
/*!*/;
4150+
# at #
4151+
# at #
4152+
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
4153+
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
4154+
### INSERT INTO `test`.`t1dec102`
4155+
### SET
4156+
### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
4157+
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
4158+
SET TIMESTAMP=1000000000/*!*/;
4159+
COMMIT
4160+
/*!*/;
4161+
# at #
4162+
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
4163+
SET TIMESTAMP=1000000000/*!*/;
4164+
BEGIN
4165+
/*!*/;
4166+
# at #
4167+
# at #
4168+
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
4169+
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
4170+
### INSERT INTO `test`.`t1dec102`
4171+
### SET
4172+
### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
4173+
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
4174+
SET TIMESTAMP=1000000000/*!*/;
4175+
COMMIT
4176+
/*!*/;
4177+
# at #
4178+
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
4179+
SET TIMESTAMP=1000000000/*!*/;
4180+
BEGIN
4181+
/*!*/;
4182+
# at #
4183+
# at #
4184+
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1dec102` mapped to number #
4185+
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
4186+
### INSERT INTO `test`.`t1dec102`
4187+
### SET
4188+
### @1=!! Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value. # at #
4189+
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
4190+
SET TIMESTAMP=1000000000/*!*/;
4191+
COMMIT
4192+
/*!*/;
4193+
# at #
4194+
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
4195+
SET TIMESTAMP=1000000000/*!*/;
4196+
DROP TABLE `t1dec102` /* generated by server */
4197+
/*!*/;
4198+
# at #
41344199
#010909 4:46:40 server id 1 end_log_pos # Rotate to master-bin.000002 pos: 4
41354200
DELIMITER ;
41364201
# End of log file

mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,20 @@ INSERT INTO t2 SET b=1;
438438
UPDATE t1, t2 SET t1.a=10, t2.a=20;
439439
DROP TABLE t1,t2;
440440

441+
let $MYSQLD_DATADIR= `select @@datadir`;
442+
443+
--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
444+
--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
445+
--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
446+
447+
INSERT INTO t1dec102 VALUES (-999.99);
448+
INSERT INTO t1dec102 VALUES (0);
449+
INSERT INTO t1dec102 VALUES (999.99);
450+
SELECT * FROM t1dec102 ORDER BY a;
451+
DROP TABLE t1dec102;
452+
441453
flush logs;
442454

443-
let $MYSQLD_DATADIR= `select @@datadir`;
444455
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
445456
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/
446457
--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001

mysql-test/t/type_decimal.test

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,3 +583,27 @@ JOIN
583583
WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL));
584584

585585
DROP TABLE t1, t2;
586+
587+
588+
--echo #
589+
--echo # Start of 5.5 tests
590+
--echo #
591+
592+
--echo #
593+
--echo # MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
594+
--echo #
595+
596+
let $MYSQLD_DATADIR= `select @@datadir`;
597+
598+
--copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
599+
--copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
600+
--copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
601+
602+
SHOW CREATE TABLE t1dec102;
603+
SHOW COLUMNS FROM t1dec102;
604+
SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
605+
DROP TABLE t1dec102;
606+
607+
--echo #
608+
--echo # End of 5.5 tests
609+
--echo #

sql/field.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2483,7 +2483,7 @@ void Field_decimal::sql_type(String &res) const
24832483
if (dec)
24842484
tmp--;
24852485
res.length(cs->cset->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
2486-
"decimal(%d,%d)",tmp,dec));
2486+
"decimal(%d,%d)/*old*/",tmp,dec));
24872487
add_zerofill_and_unsigned(res);
24882488
}
24892489

sql/log_event.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,6 +2192,12 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr,
21922192
my_snprintf(typestr, typestr_length, "STRING(%d)", length);
21932193
return my_b_write_quoted_with_length(file, ptr, length);
21942194

2195+
case MYSQL_TYPE_DECIMAL:
2196+
my_b_printf(file,
2197+
"!! Old DECIMAL (mysql-4.1 or earlier). "
2198+
"Not enough metadata to display the value. ");
2199+
break;
2200+
21952201
default:
21962202
{
21972203
char tmp[5];

0 commit comments

Comments
 (0)