Bug #89297 please allow number to varchar slave_type_conversions if target is large enough
Submitted: 18 Jan 2018 7:42
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Row Based Replication ( RBR ) Severity:S4 (Feature request)
Version:5.7.21 OS:Any
Assigned to: CPU Architecture:Any

[18 Jan 2018 7:42] Shane Bester
Description:
A slave breaks.

 Last_Errno: 1677
 Last_Error: Column 0 of table 'test.t' cannot be converted from type 'int' to type 'varchar(108(bytes) utf8)'
 

Feature Request:    We would like the above to work.

Let us read the manual on this:

https://dev.mysql.com/doc/refman/5.7/en/replication-features-differing-tables.html#replica...

"
Supported conversions.  Supported conversions between different but similar data types are shown in the following list:
o)   Between any of the integer types TINYINT, SMALLINT, MEDIUMINT, INT, and BIGINT.
o)   Between any of the decimal types DECIMAL, FLOAT, DOUBLE, and NUMERIC.
o)   Between any of the string types CHAR, VARCHAR, and TEXT, including conversions between different widths.
o)   Between any of the binary data types BINARY, VARBINARY, and BLOB, including conversions between different widths.
o)   Between any 2 BIT columns of any 2 sizes.

* Conversions between types not in the previous list are not permitted.
" 

How to repeat:
on the master:
--------------
drop table if exists t;
create table t(a int not null,primary key(a))engine=innodb;
insert into t values(1),(2),(3);

on the slave:
--------------
alter table t change a a varchar(36) character set utf8 not null;
stop slave;
set global slave_type_conversions='ALL_LOSSY,ALL_NON_LOSSY';
start slave;

on the master:
----------------
insert into t values(4);

on the slave:
-------------
show slave status \G

slave breaks.
 Last_Errno: 1677
 Last_Error: Column 0 of table 'test.t' cannot be converted from type 'int' to type 'varchar(108(bytes) utf8)'
 

Suggested fix:
Allow conversion from numeric to character/blob fields.