diff --git a/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8-to-int/alter b/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8-to-int/alter new file mode 100644 index 00000000000..ff74892c2c8 --- /dev/null +++ b/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8-to-int/alter @@ -0,0 +1 @@ +modify column t int not null default '0' diff --git a/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8-to-int/create.sql b/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8-to-int/create.sql new file mode 100644 index 00000000000..141a7f24039 --- /dev/null +++ b/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8-to-int/create.sql @@ -0,0 +1,21 @@ +drop table if exists onlineddl_test; +create table onlineddl_test ( + id int auto_increment, + t varchar(128) charset utf8 collate utf8_general_ci, + primary key(id) +) auto_increment=1; + +drop event if exists onlineddl_test; +delimiter ;; +create event onlineddl_test + on schedule every 1 second + starts current_timestamp + ends current_timestamp + interval 60 second + on completion not preserve + enable + do +begin + insert into onlineddl_test values (null, 11); + insert into onlineddl_test values (null, '13'); + insert into onlineddl_test values (null, '17'); +end ;; diff --git a/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8mb4-to-int/alter b/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8mb4-to-int/alter new file mode 100644 index 00000000000..ff74892c2c8 --- /dev/null +++ b/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8mb4-to-int/alter @@ -0,0 +1 @@ +modify column t int not null default '0' diff --git a/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8mb4-to-int/create.sql b/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8mb4-to-int/create.sql new file mode 100644 index 00000000000..9d6f82e5957 --- /dev/null +++ b/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8mb4-to-int/create.sql @@ -0,0 +1,21 @@ +drop table if exists onlineddl_test; +create table onlineddl_test ( + id int auto_increment, + t varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + primary key(id) +) auto_increment=1; + +drop event if exists onlineddl_test; +delimiter ;; +create event onlineddl_test + on schedule every 1 second + starts current_timestamp + ends current_timestamp + interval 60 second + on completion not preserve + enable + do +begin + insert into onlineddl_test values (null, 11); + insert into onlineddl_test values (null, '13'); + insert into onlineddl_test values (null, '17'); +end ;; diff --git a/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8mb4-to-int/ignore_versions b/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8mb4-to-int/ignore_versions new file mode 100644 index 00000000000..b6de5f8d9f5 --- /dev/null +++ b/go/test/endtoend/onlineddl/vrepl_suite/testdata/utf8mb4-to-int/ignore_versions @@ -0,0 +1 @@ +(5.5|5.6) diff --git a/go/vt/vttablet/onlineddl/vrepl.go b/go/vt/vttablet/onlineddl/vrepl.go index d2b1a445a10..6a94c894ff7 100644 --- a/go/vt/vttablet/onlineddl/vrepl.go +++ b/go/vt/vttablet/onlineddl/vrepl.go @@ -472,7 +472,8 @@ func (v *VRepl) generateFilterQuery(ctx context.Context) error { return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "Character set %s not supported for column %s", sourceCol.Charset, sourceCol.Name) } toEncoding, ok := mysql.CharacterSetEncoding[targetCol.Charset] - if !ok { + // Let's see if target col is at all textual + if targetCol.Type == vrepl.StringColumnType && !ok { return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "Character set %s not supported for column %s", targetCol.Charset, targetCol.Name) } if fromEncoding == nil && toEncoding == nil {