maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #11804
Re: Please review a patch for MDEV-19284 and MDEV-19285 (instant ALTER)
Hi Marko, Eugene,
Thanks for good suggestions. A new version is attached.
See details inline:
On 4/19/19 2:46 PM, Marko Mäkelä wrote:
Hi Bar,
I see that these bugs were based on wrong assumptions that ASCII or
UCS2 columns would only contain valid ASCII or UTF-16 data. We should
have tested these assumptions during the development of MDEV-15564.
Luckily these were found before the GA release of MariaDB 10.4.
That was my fault. When we had discussions on this topic with
Eugene, I overlooked these problems. Sorry for this.
Here is just a quick note before I will return to work on Tuesday.
Please remove ,algorithm=copy from tests. Instead, use
--enable_info
alter table ...
--disable_info
and make sure that the table contains at least 1 row when the ALTER
TABLE is executed. In that way, ALGORITHM=COPY will report that a
nonzero amount of rows were affected, while the native ALTER would
report that 0 rows were affected.
I added this into the new tests in the end of instant_alter_charset.test
Note, I didn't add this into original MDEV-15564 tests,
as they mostly use empty tables.
I would also suggest testing with some bad data (non-ASCII chars in
ASCII column, or Unicode surrogate pairs in UCS2) to see what kind of
errors would be triggered (if any), or what the converted data would
look like after ALTER IGNORE TABLE.
This is a very good idea. I've just added "ALTER IGNORE"s
into the new tests.
Please run the commit comment through a spell-checker. I spotted the
typos "correspoding" and "actuallt".
Done.
Also, please mention in the commit comment that these are regressions
caused by MDEV-15564. That should make our lifes easier, should we
ever decide to backport MDEV-15564 to earlier versions.
Done.
I will review the code and tests in detail next week. I hope that
Eugene can review it as well.
Best regards,
Marko
commit 11c50465849eac35a490c638bd13678f92438a69
Author: Alexander Barkov <bar@xxxxxxxxxxx>
Date: Fri Apr 19 15:18:38 2019 +0400
A joint patch for MDEV-19284 and MDEV-19285 (INSTANT ALTER)
This patch fixes:
- MDEV-19284 INSTANT ALTER with ucs2-to-utf16 conversion produces bad data
- MDEV-19285 INSTANT ALTER from ascii_general_ci to latin1_general_ci produces corrupt data
These regressions were introduced in 10.4.3 by:
- MDEV-15564 Avoid table rebuild in ALTER TABLE on collation or charset changes
Changes:
1. Cleanup: Adding a helper method
Field_longstr::csinfo_change_allows_instant_alter(),
to remove some duplicate code in field.cc.
2. Cleanup: removing Type_handler::Charsets_are_compatible() and static
function charsets_are_compatible() and
introducing new methods in the recently added class Charset instead:
- encoding_allows_reinterpret_as()
- encoding_and_order_allow_reinterpret_as()
3. Bug fix: Removing the code that allowed instant conversion for
ascii-to->8bit and ucs2-to->utf16.
This actually fixes MDEV-19284 and MDEV-19285.
4. Bug fix: Adding a helper method Charset::collation_specific_name().
The old corresponding code in Type_handler::Charsets_are_compatible()
was not safe against (badly named) used-definer collations whose
character set name can be longer than collation name.
diff --git a/mysql-test/suite/innodb/r/instant_alter_charset.result b/mysql-test/suite/innodb/r/instant_alter_charset.result
index 6242b167412..49908192458 100644
--- a/mysql-test/suite/innodb/r/instant_alter_charset.result
+++ b/mysql-test/suite/innodb/r/instant_alter_charset.result
@@ -21,6 +21,10 @@ algorithm=inplace;
alter table rebuild
change a a varchar(150) charset latin1 not null default 'asdf',
algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table rebuild
+change a a varchar(150) charset latin1 not null default 'asdf',
+algorithm=copy;
select name, prtype, len from information_schema.innodb_sys_columns
where table_id = @id;
name prtype len
@@ -40,7 +44,7 @@ e mediumtext charset ascii,
f longtext charset ascii
) engine=innodb;
alter table supported_types
-convert to charset latin1,
+convert to charset ascii collate ascii_bin,
algorithm=instant;
drop table supported_types;
create table various_cases (
@@ -49,7 +53,7 @@ b varchar(150) as (a) virtual,
c varchar(150) as (a) persistent
) engine=innodb;
alter table various_cases
-change a a char(150) charset latin1,
+change a a char(150) charset ascii collate ascii_bin,
algorithm=inplace;
alter table various_cases
change a a varchar(222),
@@ -75,7 +79,7 @@ d longtext charset ascii,
footer int
) engine=innodb;
alter table all_texts
-convert to charset latin1 collate latin1_general_ci,
+convert to charset ascii collate ascii_bin,
algorithm=instant;
drop table all_texts;
create table all_binaries (
@@ -217,6 +221,11 @@ alter table latin1_swedish_special_case
modify instant1 varchar(150) charset latin1 collate latin1_swedish_ci,
modify instant2 char(150) charset latin1 collate latin1_swedish_ci,
algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table latin1_swedish_special_case
+modify instant1 varchar(150) charset latin1 collate latin1_swedish_ci,
+modify instant2 char(150) charset latin1 collate latin1_swedish_ci,
+algorithm=copy;
select c.name, c.prtype, c.mtype, c.len from information_schema.innodb_sys_columns as c inner join information_schema.innodb_sys_tables t on c.table_id = t.table_id
where t.name = 'test/latin1_swedish_special_case';
name prtype mtype len
@@ -251,6 +260,10 @@ c varchar(300) charset ascii
alter table boundary_255
modify a varchar(50) charset utf8mb3,
algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table boundary_255
+modify a varchar(50) charset utf8mb3,
+algorithm=copy;
alter table boundary_255
modify b varchar(200) charset utf8mb3,
algorithm=instant;
@@ -258,6 +271,7 @@ ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column ty
alter table boundary_255
modify c varchar(300) charset utf8mb3,
algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table boundary_255;
create table fully_compatible (
id int auto_increment unique key,
@@ -299,28 +313,7 @@ insert into fully_compatible (from_charset, from_collate, to_charset, to_collate
('utf8mb3', 'utf8mb3_general_nopad_ci', 'utf8mb4', 'utf8mb4_general_nopad_ci'),
('utf8mb3', 'utf8mb3_nopad_bin', 'utf8mb4', 'utf8mb4_nopad_bin'),
('utf8mb3', 'utf8mb3_unicode_nopad_ci', 'utf8mb4', 'utf8mb4_unicode_nopad_ci'),
-('utf8mb3', 'utf8mb3_unicode_520_nopad_ci', 'utf8mb4', 'utf8mb4_unicode_520_nopad_ci'),
-('ucs2', 'ucs2_general_ci', 'utf16', 'utf16_general_ci'),
-('ucs2', 'ucs2_unicode_ci', 'utf16', 'utf16_unicode_ci'),
-('ucs2', 'ucs2_icelandic_ci', 'utf16', 'utf16_icelandic_ci'),
-('ucs2', 'ucs2_latvian_ci', 'utf16', 'utf16_latvian_ci'),
-('ucs2', 'ucs2_romanian_ci', 'utf16', 'utf16_romanian_ci'),
-('ucs2', 'ucs2_slovenian_ci', 'utf16', 'utf16_slovenian_ci'),
-('ucs2', 'ucs2_polish_ci', 'utf16', 'utf16_polish_ci'),
-('ucs2', 'ucs2_estonian_ci', 'utf16', 'utf16_estonian_ci'),
-('ucs2', 'ucs2_spanish_ci', 'utf16', 'utf16_spanish_ci'),
-('ucs2', 'ucs2_general_ci', 'utf16', 'utf16_general_ci'),
-('ascii', 'ascii_general_ci', 'utf8mb3', 'utf8mb3_general_ci'),
-('ascii', 'ascii_general_ci', 'utf8mb4', 'utf8mb4_general_ci'),
-('ascii', 'ascii_general_ci', 'latin1', 'latin1_general_ci'),
-('ascii', 'ascii_bin', 'latin1', 'latin1_bin'),
-('ascii', 'ascii_nopad_bin', 'latin1', 'latin1_nopad_bin'),
-('ascii', 'ascii_general_ci', 'latin2', 'latin2_general_ci'),
-('ascii', 'ascii_general_ci', 'latin7', 'latin7_general_ci'),
-('ascii', 'ascii_bin', 'koi8u', 'koi8u_bin'),
-('ascii', 'ascii_bin', 'ujis', 'ujis_bin'),
-('ascii', 'ascii_bin', 'big5', 'big5_bin'),
-('ascii', 'ascii_bin', 'gbk', 'gbk_bin')
+('utf8mb3', 'utf8mb3_unicode_520_nopad_ci', 'utf8mb4', 'utf8mb4_unicode_520_nopad_ci')
;
create table tmp (
a varchar(50) charset utf8mb3 collate utf8mb3_general_ci,
@@ -751,288 +744,234 @@ check table tmp;
Table Op Msg_type Msg_text
test.tmp check status OK
drop table tmp;
+drop table fully_compatible;
+create table compatible_without_index (
+id int auto_increment unique key,
+from_charset char(255),
+from_collate char(255),
+to_charset char(255),
+to_collate char(255)
+);
+insert into compatible_without_index (from_charset, from_collate, to_charset, to_collate) values
+('utf8mb3', 'utf8mb3_general_ci', 'utf8mb4', 'utf8mb4_vietnamese_ci'),
+('utf8mb3', 'utf8mb3_bin', 'utf8mb4', 'utf8mb4_vietnamese_ci'),
+('utf8mb3', 'utf8mb3_general_nopad_ci', 'utf8mb4', 'utf8mb4_vietnamese_ci'),
+('utf8mb3', 'utf8mb3_nopad_bin', 'utf8mb4', 'utf8mb4_vietnamese_ci'),
+('ascii', 'ascii_general_ci', 'ascii', 'ascii_bin'),
+('utf8mb3', 'utf8mb3_roman_ci', 'utf8mb3', 'utf8mb3_lithuanian_ci'),
+('utf8mb4', 'utf8mb4_thai_520_w2', 'utf8mb4', 'utf8mb4_persian_ci'),
+('utf8mb3', 'utf8mb3_myanmar_ci', 'utf8mb4', 'utf8mb4_german2_ci'),
+('utf8mb3', 'utf8mb3_general_ci', 'utf8mb3', 'utf8mb3_unicode_ci'),
+('latin1', 'latin1_general_cs', 'latin1', 'latin1_general_ci'),
+('utf16', 'utf16_general_ci', 'utf16', 'utf16_german2_ci')
+;
create table tmp (
-a varchar(50) charset ucs2 collate ucs2_general_ci,
-b varchar(50) charset ucs2 collate ucs2_general_ci primary key
+a varchar(50) charset utf8mb3 collate utf8mb3_general_ci,
+b varchar(50) charset utf8mb3 collate utf8mb3_general_ci unique key,
+c varchar(50) charset utf8mb3 collate utf8mb3_general_ci primary key
) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset utf16 collate utf16_general_ci,
-modify b varchar(50) charset utf16 collate utf16_general_ci,
+change a a varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
-drop table tmp;
-create table tmp (
-a varchar(50) charset ucs2 collate ucs2_unicode_ci,
-b varchar(50) charset ucs2 collate ucs2_unicode_ci primary key
-) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset utf16 collate utf16_unicode_ci,
-modify b varchar(50) charset utf16 collate utf16_unicode_ci,
+modify b varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
-drop table tmp;
-create table tmp (
-a varchar(50) charset ucs2 collate ucs2_icelandic_ci,
-b varchar(50) charset ucs2 collate ucs2_icelandic_ci primary key
-) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-change a a varchar(50) charset utf16 collate utf16_icelandic_ci,
-modify b varchar(50) charset utf16 collate utf16_icelandic_ci,
+modify c varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ucs2 collate ucs2_latvian_ci,
-b varchar(50) charset ucs2 collate ucs2_latvian_ci primary key
+a varchar(50) charset utf8mb3 collate utf8mb3_bin,
+b varchar(50) charset utf8mb3 collate utf8mb3_bin unique key,
+c varchar(50) charset utf8mb3 collate utf8mb3_bin primary key
) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset utf16 collate utf16_latvian_ci,
-modify b varchar(50) charset utf16 collate utf16_latvian_ci,
+change a a varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
-drop table tmp;
-create table tmp (
-a varchar(50) charset ucs2 collate ucs2_romanian_ci,
-b varchar(50) charset ucs2 collate ucs2_romanian_ci primary key
-) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset utf16 collate utf16_romanian_ci,
-modify b varchar(50) charset utf16 collate utf16_romanian_ci,
+modify b varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
-drop table tmp;
-create table tmp (
-a varchar(50) charset ucs2 collate ucs2_slovenian_ci,
-b varchar(50) charset ucs2 collate ucs2_slovenian_ci primary key
-) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-change a a varchar(50) charset utf16 collate utf16_slovenian_ci,
-modify b varchar(50) charset utf16 collate utf16_slovenian_ci,
+modify c varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ucs2 collate ucs2_polish_ci,
-b varchar(50) charset ucs2 collate ucs2_polish_ci primary key
+a varchar(50) charset utf8mb3 collate utf8mb3_general_nopad_ci,
+b varchar(50) charset utf8mb3 collate utf8mb3_general_nopad_ci unique key,
+c varchar(50) charset utf8mb3 collate utf8mb3_general_nopad_ci primary key
) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset utf16 collate utf16_polish_ci,
-modify b varchar(50) charset utf16 collate utf16_polish_ci,
+change a a varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
-drop table tmp;
-create table tmp (
-a varchar(50) charset ucs2 collate ucs2_estonian_ci,
-b varchar(50) charset ucs2 collate ucs2_estonian_ci primary key
-) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset utf16 collate utf16_estonian_ci,
-modify b varchar(50) charset utf16 collate utf16_estonian_ci,
+modify b varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
-drop table tmp;
-create table tmp (
-a varchar(50) charset ucs2 collate ucs2_spanish_ci,
-b varchar(50) charset ucs2 collate ucs2_spanish_ci primary key
-) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-change a a varchar(50) charset utf16 collate utf16_spanish_ci,
-modify b varchar(50) charset utf16 collate utf16_spanish_ci,
+modify c varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ucs2 collate ucs2_general_ci,
-b varchar(50) charset ucs2 collate ucs2_general_ci primary key
+a varchar(50) charset utf8mb3 collate utf8mb3_nopad_bin,
+b varchar(50) charset utf8mb3 collate utf8mb3_nopad_bin unique key,
+c varchar(50) charset utf8mb3 collate utf8mb3_nopad_bin primary key
) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset utf16 collate utf16_general_ci,
-modify b varchar(50) charset utf16 collate utf16_general_ci,
+change a a varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
+algorithm=instant;
+alter table tmp
+modify b varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
-drop table tmp;
-create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci primary key
-) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-change a a varchar(50) charset utf8mb3 collate utf8mb3_general_ci,
-modify b varchar(50) charset utf8mb3 collate utf8mb3_general_ci,
+modify c varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci primary key
+b varchar(50) charset ascii collate ascii_general_ci unique key,
+c varchar(50) charset ascii collate ascii_general_ci primary key
) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset utf8mb4 collate utf8mb4_general_ci,
-modify b varchar(50) charset utf8mb4 collate utf8mb4_general_ci,
+change a a varchar(50) charset ascii collate ascii_bin,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
-drop table tmp;
-create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci primary key
-) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset latin1 collate latin1_general_ci,
-modify b varchar(50) charset latin1 collate latin1_general_ci,
+modify b varchar(50) charset ascii collate ascii_bin,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
-drop table tmp;
-create table tmp (
-a varchar(50) charset ascii collate ascii_bin,
-b varchar(50) charset ascii collate ascii_bin primary key
-) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-change a a varchar(50) charset latin1 collate latin1_bin,
-modify b varchar(50) charset latin1 collate latin1_bin,
+modify c varchar(50) charset ascii collate ascii_bin,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_nopad_bin,
-b varchar(50) charset ascii collate ascii_nopad_bin primary key
+a varchar(50) charset utf8mb3 collate utf8mb3_roman_ci,
+b varchar(50) charset utf8mb3 collate utf8mb3_roman_ci unique key,
+c varchar(50) charset utf8mb3 collate utf8mb3_roman_ci primary key
) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset latin1 collate latin1_nopad_bin,
-modify b varchar(50) charset latin1 collate latin1_nopad_bin,
+change a a varchar(50) charset utf8mb3 collate utf8mb3_lithuanian_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
-drop table tmp;
-create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci primary key
-) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset latin2 collate latin2_general_ci,
-modify b varchar(50) charset latin2 collate latin2_general_ci,
+modify b varchar(50) charset utf8mb3 collate utf8mb3_lithuanian_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
-drop table tmp;
-create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci primary key
-) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-change a a varchar(50) charset latin7 collate latin7_general_ci,
-modify b varchar(50) charset latin7 collate latin7_general_ci,
+modify c varchar(50) charset utf8mb3 collate utf8mb3_lithuanian_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_bin,
-b varchar(50) charset ascii collate ascii_bin primary key
+a varchar(50) charset utf8mb4 collate utf8mb4_thai_520_w2,
+b varchar(50) charset utf8mb4 collate utf8mb4_thai_520_w2 unique key,
+c varchar(50) charset utf8mb4 collate utf8mb4_thai_520_w2 primary key
) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset koi8u collate koi8u_bin,
-modify b varchar(50) charset koi8u collate koi8u_bin,
+change a a varchar(50) charset utf8mb4 collate utf8mb4_persian_ci,
+algorithm=instant;
+alter table tmp
+modify b varchar(50) charset utf8mb4 collate utf8mb4_persian_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table tmp
+modify c varchar(50) charset utf8mb4 collate utf8mb4_persian_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_bin,
-b varchar(50) charset ascii collate ascii_bin primary key
+a varchar(50) charset utf8mb3 collate utf8mb3_myanmar_ci,
+b varchar(50) charset utf8mb3 collate utf8mb3_myanmar_ci unique key,
+c varchar(50) charset utf8mb3 collate utf8mb3_myanmar_ci primary key
) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset ujis collate ujis_bin,
-modify b varchar(50) charset ujis collate ujis_bin,
+change a a varchar(50) charset utf8mb4 collate utf8mb4_german2_ci,
+algorithm=instant;
+alter table tmp
+modify b varchar(50) charset utf8mb4 collate utf8mb4_german2_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table tmp
+modify c varchar(50) charset utf8mb4 collate utf8mb4_german2_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_bin,
-b varchar(50) charset ascii collate ascii_bin primary key
+a varchar(50) charset utf8mb3 collate utf8mb3_general_ci,
+b varchar(50) charset utf8mb3 collate utf8mb3_general_ci unique key,
+c varchar(50) charset utf8mb3 collate utf8mb3_general_ci primary key
) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset big5 collate big5_bin,
-modify b varchar(50) charset big5 collate big5_bin,
+change a a varchar(50) charset utf8mb3 collate utf8mb3_unicode_ci,
+algorithm=instant;
+alter table tmp
+modify b varchar(50) charset utf8mb3 collate utf8mb3_unicode_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table tmp
+modify c varchar(50) charset utf8mb3 collate utf8mb3_unicode_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_bin,
-b varchar(50) charset ascii collate ascii_bin primary key
+a varchar(50) charset latin1 collate latin1_general_cs,
+b varchar(50) charset latin1 collate latin1_general_cs unique key,
+c varchar(50) charset latin1 collate latin1_general_cs primary key
) engine=innodb;
-insert into tmp values ('AAA', 'AAA'), ('bbb', 'bbb');
alter table tmp
-change a a varchar(50) charset gbk collate gbk_bin,
-modify b varchar(50) charset gbk collate gbk_bin,
+change a a varchar(50) charset latin1 collate latin1_general_ci,
algorithm=instant;
-check table tmp;
-Table Op Msg_type Msg_text
-test.tmp check status OK
+alter table tmp
+modify b varchar(50) charset latin1 collate latin1_general_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table tmp
+modify c varchar(50) charset latin1 collate latin1_general_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
-drop table fully_compatible;
-create table compatible_without_index (
+create table tmp (
+a varchar(50) charset utf16 collate utf16_general_ci,
+b varchar(50) charset utf16 collate utf16_general_ci unique key,
+c varchar(50) charset utf16 collate utf16_general_ci primary key
+) engine=innodb;
+alter table tmp
+change a a varchar(50) charset utf16 collate utf16_german2_ci,
+algorithm=instant;
+alter table tmp
+modify b varchar(50) charset utf16 collate utf16_german2_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table tmp
+modify c varchar(50) charset utf16 collate utf16_german2_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+drop table tmp;
+drop table compatible_without_index;
+create table fully_incompatible (
id int auto_increment unique key,
from_charset char(255),
from_collate char(255),
to_charset char(255),
to_collate char(255)
);
-insert into compatible_without_index (from_charset, from_collate, to_charset, to_collate) values
+insert into fully_incompatible (from_charset, from_collate, to_charset, to_collate) values
+('ascii', 'ascii_general_ci', 'utf8mb3', 'utf8mb3_general_ci'),
+('ascii', 'ascii_general_ci', 'utf8mb4', 'utf8mb4_general_ci'),
+('ascii', 'ascii_general_ci', 'latin1', 'latin1_general_ci'),
+('ascii', 'ascii_bin', 'latin1', 'latin1_bin'),
+('ascii', 'ascii_nopad_bin', 'latin1', 'latin1_nopad_bin'),
+('ascii', 'ascii_general_ci', 'latin2', 'latin2_general_ci'),
+('ascii', 'ascii_general_ci', 'latin7', 'latin7_general_ci'),
+('ascii', 'ascii_bin', 'koi8u', 'koi8u_bin'),
+('ascii', 'ascii_bin', 'ujis', 'ujis_bin'),
+('ascii', 'ascii_bin', 'big5', 'big5_bin'),
+('ascii', 'ascii_bin', 'gbk', 'gbk_bin'),
('ascii', 'ascii_general_ci', 'utf8mb3', 'utf8mb3_swedish_ci'),
('ascii', 'ascii_bin', 'latin1', 'latin1_swedish_ci'),
('ascii', 'ascii_general_nopad_ci', 'latin1', 'latin1_swedish_ci'),
@@ -1048,641 +987,665 @@ insert into compatible_without_index (from_charset, from_collate, to_charset, to
('ascii', 'ascii_bin', 'utf8mb4', 'utf8mb4_danish_ci'),
('ascii', 'ascii_general_nopad_ci', 'utf8mb4', 'utf8mb4_danish_ci'),
('ascii', 'ascii_nopad_bin', 'utf8mb4', 'utf8mb4_danish_ci'),
-('utf8mb3', 'utf8mb3_general_ci', 'utf8mb4', 'utf8mb4_vietnamese_ci'),
-('utf8mb3', 'utf8mb3_bin', 'utf8mb4', 'utf8mb4_vietnamese_ci'),
-('utf8mb3', 'utf8mb3_general_nopad_ci', 'utf8mb4', 'utf8mb4_vietnamese_ci'),
-('utf8mb3', 'utf8mb3_nopad_bin', 'utf8mb4', 'utf8mb4_vietnamese_ci'),
-('ascii', 'ascii_general_ci', 'gbk', 'gbk_chinese_ci'),
-('ascii', 'ascii_general_ci', 'gbk', 'gbk_chinese_nopad_ci'),
+('ascii', 'ascii_general_ci', 'gbk', 'gbk_chinese_ci'),
+('ascii', 'ascii_general_ci', 'gbk', 'gbk_chinese_nopad_ci'),
+('ascii', 'ascii_general_ci', 'ujis', 'ujis_japanese_ci'),
+('ascii', 'ascii_general_ci', 'big5', 'big5_chinese_ci'),
+('ascii', 'ascii_general_ci', 'latin2', 'latin2_croatian_ci'),
+('ascii', 'ascii_general_ci', 'latin7', 'latin7_estonian_cs'),
+('ucs2', 'ucs2_general_ci', 'utf16', 'utf16_general_ci'),
+('ucs2', 'ucs2_unicode_ci', 'utf16', 'utf16_unicode_ci'),
+('ucs2', 'ucs2_icelandic_ci', 'utf16', 'utf16_icelandic_ci'),
+('ucs2', 'ucs2_latvian_ci', 'utf16', 'utf16_latvian_ci'),
+('ucs2', 'ucs2_romanian_ci', 'utf16', 'utf16_romanian_ci'),
+('ucs2', 'ucs2_slovenian_ci', 'utf16', 'utf16_slovenian_ci'),
+('ucs2', 'ucs2_polish_ci', 'utf16', 'utf16_polish_ci'),
+('ucs2', 'ucs2_estonian_ci', 'utf16', 'utf16_estonian_ci'),
+('ucs2', 'ucs2_spanish_ci', 'utf16', 'utf16_spanish_ci'),
+('ucs2', 'ucs2_general_ci', 'utf16', 'utf16_general_ci'),
('ucs2', 'ucs2_myanmar_ci', 'utf16', 'utf16_thai_520_w2'),
('ucs2', 'ucs2_general_ci', 'utf16', 'utf16_unicode_nopad_ci'),
('ucs2', 'ucs2_general_mysql500_ci', 'utf16', 'utf16_spanish2_ci'),
-('ascii', 'ascii_general_ci', 'ascii', 'ascii_bin'),
-('utf8mb3', 'utf8mb3_roman_ci', 'utf8mb3', 'utf8mb3_lithuanian_ci'),
-('utf8mb4', 'utf8mb4_thai_520_w2', 'utf8mb4', 'utf8mb4_persian_ci'),
-('utf8mb3', 'utf8mb3_myanmar_ci', 'utf8mb4', 'utf8mb4_german2_ci'),
-('utf8mb3', 'utf8mb3_general_ci', 'utf8mb3', 'utf8mb3_unicode_ci'),
-('latin1', 'latin1_general_cs', 'latin1', 'latin1_general_ci'),
-('ascii', 'ascii_general_ci', 'ujis', 'ujis_japanese_ci'),
-('ascii', 'ascii_general_ci', 'big5', 'big5_chinese_ci'),
-('ascii', 'ascii_general_ci', 'latin2', 'latin2_croatian_ci'),
-('ascii', 'ascii_general_ci', 'latin7', 'latin7_estonian_cs'),
-('utf16', 'utf16_general_ci', 'utf16', 'utf16_german2_ci')
+('utf8mb4', 'utf8mb4_general_ci', 'utf8mb3', 'utf8mb3_general_ci'),
+('utf8mb4', 'utf8mb4_general_ci', 'ascii', 'ascii_general_ci'),
+('utf8mb3', 'utf8mb3_general_ci', 'ascii', 'ascii_general_ci'),
+('utf8mb3', 'utf8mb3_general_ci', 'latin1', 'latin1_general_ci'),
+('utf16', 'utf16_general_ci', 'utf32', 'utf32_general_ci'),
+('latin1', 'latin1_general_ci', 'ascii', 'ascii_general_ci'),
+('ascii', 'ascii_general_ci', 'swe7', 'swe7_swedish_ci'),
+('eucjpms', 'eucjpms_japanese_nopad_ci', 'geostd8', 'geostd8_general_ci'),
+('latin1', 'latin1_general_ci', 'utf16', 'utf16_general_ci')
;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci unique key,
-c varchar(50) charset ascii collate ascii_general_ci primary key
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb3 collate utf8mb3_swedish_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf8mb3 collate utf8mb3_swedish_ci,
+change a a varchar(150) charset utf8mb3 collate utf8mb3_general_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf8mb3 collate utf8mb3_swedish_ci,
+modify b text charset utf8mb3 collate utf8mb3_general_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_bin,
-b varchar(50) charset ascii collate ascii_bin unique key,
-c varchar(50) charset ascii collate ascii_bin primary key
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset latin1 collate latin1_swedish_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset latin1 collate latin1_swedish_ci,
+change a a varchar(150) charset utf8mb4 collate utf8mb4_general_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset latin1 collate latin1_swedish_ci,
+modify b text charset utf8mb4 collate utf8mb4_general_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_nopad_ci,
-b varchar(50) charset ascii collate ascii_general_nopad_ci unique key,
-c varchar(50) charset ascii collate ascii_general_nopad_ci primary key
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset latin1 collate latin1_swedish_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset latin1 collate latin1_swedish_ci,
+change a a varchar(150) charset latin1 collate latin1_general_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset latin1 collate latin1_swedish_ci,
+modify b text charset latin1 collate latin1_general_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_nopad_bin,
-b varchar(50) charset ascii collate ascii_nopad_bin unique key,
-c varchar(50) charset ascii collate ascii_nopad_bin primary key
+a varchar(150) charset ascii collate ascii_bin,
+b text(150) charset ascii collate ascii_bin,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset latin1 collate latin1_swedish_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset latin1 collate latin1_swedish_ci,
+change a a varchar(150) charset latin1 collate latin1_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset latin1 collate latin1_swedish_ci,
+modify b text charset latin1 collate latin1_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci unique key,
-c varchar(50) charset ascii collate ascii_general_ci primary key
+a varchar(150) charset ascii collate ascii_nopad_bin,
+b text(150) charset ascii collate ascii_nopad_bin,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset koi8u collate koi8u_bin,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset koi8u collate koi8u_bin,
+change a a varchar(150) charset latin1 collate latin1_nopad_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset koi8u collate koi8u_bin,
+modify b text charset latin1 collate latin1_nopad_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_nopad_ci,
-b varchar(50) charset ascii collate ascii_general_nopad_ci unique key,
-c varchar(50) charset ascii collate ascii_general_nopad_ci primary key
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset koi8u collate koi8u_bin,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset koi8u collate koi8u_bin,
+change a a varchar(150) charset latin2 collate latin2_general_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset koi8u collate koi8u_bin,
+modify b text charset latin2 collate latin2_general_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_nopad_bin,
-b varchar(50) charset ascii collate ascii_nopad_bin unique key,
-c varchar(50) charset ascii collate ascii_nopad_bin primary key
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset koi8u collate koi8u_bin,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset koi8u collate koi8u_bin,
+change a a varchar(150) charset latin7 collate latin7_general_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset koi8u collate koi8u_bin,
+modify b text charset latin7 collate latin7_general_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci unique key,
-c varchar(50) charset ascii collate ascii_general_ci primary key
+a varchar(150) charset ascii collate ascii_bin,
+b text(150) charset ascii collate ascii_bin,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset latin1 collate latin1_swedish_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset latin1 collate latin1_swedish_ci,
+change a a varchar(150) charset koi8u collate koi8u_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset latin1 collate latin1_swedish_ci,
+modify b text charset koi8u collate koi8u_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_bin,
-b varchar(50) charset ascii collate ascii_bin unique key,
-c varchar(50) charset ascii collate ascii_bin primary key
+a varchar(150) charset ascii collate ascii_bin,
+b text(150) charset ascii collate ascii_bin,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb3 collate utf8mb3_swedish_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf8mb3 collate utf8mb3_swedish_ci,
+change a a varchar(150) charset ujis collate ujis_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf8mb3 collate utf8mb3_swedish_ci,
+modify b text charset ujis collate ujis_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_nopad_ci,
-b varchar(50) charset ascii collate ascii_general_nopad_ci unique key,
-c varchar(50) charset ascii collate ascii_general_nopad_ci primary key
+a varchar(150) charset ascii collate ascii_bin,
+b text(150) charset ascii collate ascii_bin,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb3 collate utf8mb3_swedish_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf8mb3 collate utf8mb3_swedish_ci,
+change a a varchar(150) charset big5 collate big5_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf8mb3 collate utf8mb3_swedish_ci,
+modify b text charset big5 collate big5_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_nopad_bin,
-b varchar(50) charset ascii collate ascii_nopad_bin unique key,
-c varchar(50) charset ascii collate ascii_nopad_bin primary key
+a varchar(150) charset ascii collate ascii_bin,
+b text(150) charset ascii collate ascii_bin,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb3 collate utf8mb3_swedish_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf8mb3 collate utf8mb3_swedish_ci,
+change a a varchar(150) charset gbk collate gbk_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf8mb3 collate utf8mb3_swedish_ci,
+modify b text charset gbk collate gbk_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci unique key,
-c varchar(50) charset ascii collate ascii_general_ci primary key
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb4 collate utf8mb4_danish_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf8mb4 collate utf8mb4_danish_ci,
+change a a varchar(150) charset utf8mb3 collate utf8mb3_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf8mb4 collate utf8mb4_danish_ci,
+modify b text charset utf8mb3 collate utf8mb3_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_bin,
-b varchar(50) charset ascii collate ascii_bin unique key,
-c varchar(50) charset ascii collate ascii_bin primary key
+a varchar(150) charset ascii collate ascii_bin,
+b text(150) charset ascii collate ascii_bin,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb4 collate utf8mb4_danish_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf8mb4 collate utf8mb4_danish_ci,
+change a a varchar(150) charset latin1 collate latin1_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf8mb4 collate utf8mb4_danish_ci,
+modify b text charset latin1 collate latin1_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_nopad_ci,
-b varchar(50) charset ascii collate ascii_general_nopad_ci unique key,
-c varchar(50) charset ascii collate ascii_general_nopad_ci primary key
+a varchar(150) charset ascii collate ascii_general_nopad_ci,
+b text(150) charset ascii collate ascii_general_nopad_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb4 collate utf8mb4_danish_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf8mb4 collate utf8mb4_danish_ci,
+change a a varchar(150) charset latin1 collate latin1_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf8mb4 collate utf8mb4_danish_ci,
+modify b text charset latin1 collate latin1_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_nopad_bin,
-b varchar(50) charset ascii collate ascii_nopad_bin unique key,
-c varchar(50) charset ascii collate ascii_nopad_bin primary key
+a varchar(150) charset ascii collate ascii_nopad_bin,
+b text(150) charset ascii collate ascii_nopad_bin,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb4 collate utf8mb4_danish_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf8mb4 collate utf8mb4_danish_ci,
+change a a varchar(150) charset latin1 collate latin1_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf8mb4 collate utf8mb4_danish_ci,
+modify b text charset latin1 collate latin1_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset utf8mb3 collate utf8mb3_general_ci,
-b varchar(50) charset utf8mb3 collate utf8mb3_general_ci unique key,
-c varchar(50) charset utf8mb3 collate utf8mb3_general_ci primary key
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
+change a a varchar(150) charset koi8u collate koi8u_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
+modify b text charset koi8u collate koi8u_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset utf8mb3 collate utf8mb3_bin,
-b varchar(50) charset utf8mb3 collate utf8mb3_bin unique key,
-c varchar(50) charset utf8mb3 collate utf8mb3_bin primary key
+a varchar(150) charset ascii collate ascii_general_nopad_ci,
+b text(150) charset ascii collate ascii_general_nopad_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
+change a a varchar(150) charset koi8u collate koi8u_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
+modify b text charset koi8u collate koi8u_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset utf8mb3 collate utf8mb3_general_nopad_ci,
-b varchar(50) charset utf8mb3 collate utf8mb3_general_nopad_ci unique key,
-c varchar(50) charset utf8mb3 collate utf8mb3_general_nopad_ci primary key
+a varchar(150) charset ascii collate ascii_nopad_bin,
+b text(150) charset ascii collate ascii_nopad_bin,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
+change a a varchar(150) charset koi8u collate koi8u_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
+modify b text charset koi8u collate koi8u_bin,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset utf8mb3 collate utf8mb3_nopad_bin,
-b varchar(50) charset utf8mb3 collate utf8mb3_nopad_bin unique key,
-c varchar(50) charset utf8mb3 collate utf8mb3_nopad_bin primary key
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
+change a a varchar(150) charset latin1 collate latin1_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf8mb4 collate utf8mb4_vietnamese_ci,
+modify b text charset latin1 collate latin1_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci unique key,
-c varchar(50) charset ascii collate ascii_general_ci primary key
+a varchar(150) charset ascii collate ascii_bin,
+b text(150) charset ascii collate ascii_bin,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset gbk collate gbk_chinese_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset gbk collate gbk_chinese_ci,
+change a a varchar(150) charset utf8mb3 collate utf8mb3_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset gbk collate gbk_chinese_ci,
+modify b text charset utf8mb3 collate utf8mb3_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci unique key,
-c varchar(50) charset ascii collate ascii_general_ci primary key
+a varchar(150) charset ascii collate ascii_general_nopad_ci,
+b text(150) charset ascii collate ascii_general_nopad_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset gbk collate gbk_chinese_nopad_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset gbk collate gbk_chinese_nopad_ci,
+change a a varchar(150) charset utf8mb3 collate utf8mb3_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset gbk collate gbk_chinese_nopad_ci,
+modify b text charset utf8mb3 collate utf8mb3_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ucs2 collate ucs2_myanmar_ci,
-b varchar(50) charset ucs2 collate ucs2_myanmar_ci unique key,
-c varchar(50) charset ucs2 collate ucs2_myanmar_ci primary key
+a varchar(150) charset ascii collate ascii_nopad_bin,
+b text(150) charset ascii collate ascii_nopad_bin,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf16 collate utf16_thai_520_w2,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf16 collate utf16_thai_520_w2,
+change a a varchar(150) charset utf8mb3 collate utf8mb3_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf16 collate utf16_thai_520_w2,
+modify b text charset utf8mb3 collate utf8mb3_swedish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ucs2 collate ucs2_general_ci,
-b varchar(50) charset ucs2 collate ucs2_general_ci unique key,
-c varchar(50) charset ucs2 collate ucs2_general_ci primary key
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf16 collate utf16_unicode_nopad_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf16 collate utf16_unicode_nopad_ci,
+change a a varchar(150) charset utf8mb4 collate utf8mb4_danish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf16 collate utf16_unicode_nopad_ci,
+modify b text charset utf8mb4 collate utf8mb4_danish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ucs2 collate ucs2_general_mysql500_ci,
-b varchar(50) charset ucs2 collate ucs2_general_mysql500_ci unique key,
-c varchar(50) charset ucs2 collate ucs2_general_mysql500_ci primary key
+a varchar(150) charset ascii collate ascii_bin,
+b text(150) charset ascii collate ascii_bin,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf16 collate utf16_spanish2_ci,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset utf16 collate utf16_spanish2_ci,
+change a a varchar(150) charset utf8mb4 collate utf8mb4_danish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf16 collate utf16_spanish2_ci,
+modify b text charset utf8mb4 collate utf8mb4_danish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci unique key,
-c varchar(50) charset ascii collate ascii_general_ci primary key
+a varchar(150) charset ascii collate ascii_general_nopad_ci,
+b text(150) charset ascii collate ascii_general_nopad_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset ascii collate ascii_bin,
-algorithm=instant;
-alter table tmp
-modify b varchar(50) charset ascii collate ascii_bin,
+change a a varchar(150) charset utf8mb4 collate utf8mb4_danish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset ascii collate ascii_bin,
+modify b text charset utf8mb4 collate utf8mb4_danish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset utf8mb3 collate utf8mb3_roman_ci,
-b varchar(50) charset utf8mb3 collate utf8mb3_roman_ci unique key,
-c varchar(50) charset utf8mb3 collate utf8mb3_roman_ci primary key
+a varchar(150) charset ascii collate ascii_nopad_bin,
+b text(150) charset ascii collate ascii_nopad_bin,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb3 collate utf8mb3_lithuanian_ci,
+change a a varchar(150) charset utf8mb4 collate utf8mb4_danish_ci,
algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify b varchar(50) charset utf8mb3 collate utf8mb3_lithuanian_ci,
+modify b text charset utf8mb4 collate utf8mb4_danish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+drop table tmp;
+create table tmp (
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
+) engine=innodb;
alter table tmp
-modify c varchar(50) charset utf8mb3 collate utf8mb3_lithuanian_ci,
+change a a varchar(150) charset gbk collate gbk_chinese_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table tmp
+modify b text charset gbk collate gbk_chinese_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset utf8mb4 collate utf8mb4_thai_520_w2,
-b varchar(50) charset utf8mb4 collate utf8mb4_thai_520_w2 unique key,
-c varchar(50) charset utf8mb4 collate utf8mb4_thai_520_w2 primary key
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb4 collate utf8mb4_persian_ci,
+change a a varchar(150) charset gbk collate gbk_chinese_nopad_ci,
algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify b varchar(50) charset utf8mb4 collate utf8mb4_persian_ci,
+modify b text charset gbk collate gbk_chinese_nopad_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+drop table tmp;
+create table tmp (
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
+) engine=innodb;
+alter table tmp
+change a a varchar(150) charset ujis collate ujis_japanese_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf8mb4 collate utf8mb4_persian_ci,
+modify b text charset ujis collate ujis_japanese_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset utf8mb3 collate utf8mb3_myanmar_ci,
-b varchar(50) charset utf8mb3 collate utf8mb3_myanmar_ci unique key,
-c varchar(50) charset utf8mb3 collate utf8mb3_myanmar_ci primary key
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb4 collate utf8mb4_german2_ci,
+change a a varchar(150) charset big5 collate big5_chinese_ci,
algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify b varchar(50) charset utf8mb4 collate utf8mb4_german2_ci,
+modify b text charset big5 collate big5_chinese_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+drop table tmp;
+create table tmp (
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
+) engine=innodb;
alter table tmp
-modify c varchar(50) charset utf8mb4 collate utf8mb4_german2_ci,
+change a a varchar(150) charset latin2 collate latin2_croatian_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table tmp
+modify b text charset latin2 collate latin2_croatian_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset utf8mb3 collate utf8mb3_general_ci,
-b varchar(50) charset utf8mb3 collate utf8mb3_general_ci unique key,
-c varchar(50) charset utf8mb3 collate utf8mb3_general_ci primary key
+a varchar(150) charset ascii collate ascii_general_ci,
+b text(150) charset ascii collate ascii_general_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf8mb3 collate utf8mb3_unicode_ci,
+change a a varchar(150) charset latin7 collate latin7_estonian_cs,
algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify b varchar(50) charset utf8mb3 collate utf8mb3_unicode_ci,
+modify b text charset latin7 collate latin7_estonian_cs,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+drop table tmp;
+create table tmp (
+a varchar(150) charset ucs2 collate ucs2_general_ci,
+b text(150) charset ucs2 collate ucs2_general_ci,
+unique key b_idx (b(150))
+) engine=innodb;
alter table tmp
-modify c varchar(50) charset utf8mb3 collate utf8mb3_unicode_ci,
+change a a varchar(150) charset utf16 collate utf16_general_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table tmp
+modify b text charset utf16 collate utf16_general_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset latin1 collate latin1_general_cs,
-b varchar(50) charset latin1 collate latin1_general_cs unique key,
-c varchar(50) charset latin1 collate latin1_general_cs primary key
+a varchar(150) charset ucs2 collate ucs2_unicode_ci,
+b text(150) charset ucs2 collate ucs2_unicode_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset latin1 collate latin1_general_ci,
+change a a varchar(150) charset utf16 collate utf16_unicode_ci,
algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify b varchar(50) charset latin1 collate latin1_general_ci,
+modify b text charset utf16 collate utf16_unicode_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+drop table tmp;
+create table tmp (
+a varchar(150) charset ucs2 collate ucs2_icelandic_ci,
+b text(150) charset ucs2 collate ucs2_icelandic_ci,
+unique key b_idx (b(150))
+) engine=innodb;
alter table tmp
-modify c varchar(50) charset latin1 collate latin1_general_ci,
+change a a varchar(150) charset utf16 collate utf16_icelandic_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table tmp
+modify b text charset utf16 collate utf16_icelandic_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci unique key,
-c varchar(50) charset ascii collate ascii_general_ci primary key
+a varchar(150) charset ucs2 collate ucs2_latvian_ci,
+b text(150) charset ucs2 collate ucs2_latvian_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset ujis collate ujis_japanese_ci,
+change a a varchar(150) charset utf16 collate utf16_latvian_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table tmp
+modify b text charset utf16 collate utf16_latvian_ci,
algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+drop table tmp;
+create table tmp (
+a varchar(150) charset ucs2 collate ucs2_romanian_ci,
+b text(150) charset ucs2 collate ucs2_romanian_ci,
+unique key b_idx (b(150))
+) engine=innodb;
alter table tmp
-modify b varchar(50) charset ujis collate ujis_japanese_ci,
+change a a varchar(150) charset utf16 collate utf16_romanian_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset ujis collate ujis_japanese_ci,
+modify b text charset utf16 collate utf16_romanian_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci unique key,
-c varchar(50) charset ascii collate ascii_general_ci primary key
+a varchar(150) charset ucs2 collate ucs2_slovenian_ci,
+b text(150) charset ucs2 collate ucs2_slovenian_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset big5 collate big5_chinese_ci,
+change a a varchar(150) charset utf16 collate utf16_slovenian_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table tmp
+modify b text charset utf16 collate utf16_slovenian_ci,
algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+drop table tmp;
+create table tmp (
+a varchar(150) charset ucs2 collate ucs2_polish_ci,
+b text(150) charset ucs2 collate ucs2_polish_ci,
+unique key b_idx (b(150))
+) engine=innodb;
alter table tmp
-modify b varchar(50) charset big5 collate big5_chinese_ci,
+change a a varchar(150) charset utf16 collate utf16_polish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset big5 collate big5_chinese_ci,
+modify b text charset utf16 collate utf16_polish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci unique key,
-c varchar(50) charset ascii collate ascii_general_ci primary key
+a varchar(150) charset ucs2 collate ucs2_estonian_ci,
+b text(150) charset ucs2 collate ucs2_estonian_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset latin2 collate latin2_croatian_ci,
+change a a varchar(150) charset utf16 collate utf16_estonian_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table tmp
+modify b text charset utf16 collate utf16_estonian_ci,
algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+drop table tmp;
+create table tmp (
+a varchar(150) charset ucs2 collate ucs2_spanish_ci,
+b text(150) charset ucs2 collate ucs2_spanish_ci,
+unique key b_idx (b(150))
+) engine=innodb;
alter table tmp
-modify b varchar(50) charset latin2 collate latin2_croatian_ci,
+change a a varchar(150) charset utf16 collate utf16_spanish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset latin2 collate latin2_croatian_ci,
+modify b text charset utf16 collate utf16_spanish_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset ascii collate ascii_general_ci,
-b varchar(50) charset ascii collate ascii_general_ci unique key,
-c varchar(50) charset ascii collate ascii_general_ci primary key
+a varchar(150) charset ucs2 collate ucs2_general_ci,
+b text(150) charset ucs2 collate ucs2_general_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset latin7 collate latin7_estonian_cs,
+change a a varchar(150) charset utf16 collate utf16_general_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+alter table tmp
+modify b text charset utf16 collate utf16_general_ci,
algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+drop table tmp;
+create table tmp (
+a varchar(150) charset ucs2 collate ucs2_myanmar_ci,
+b text(150) charset ucs2 collate ucs2_myanmar_ci,
+unique key b_idx (b(150))
+) engine=innodb;
alter table tmp
-modify b varchar(50) charset latin7 collate latin7_estonian_cs,
+change a a varchar(150) charset utf16 collate utf16_thai_520_w2,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset latin7 collate latin7_estonian_cs,
+modify b text charset utf16 collate utf16_thai_520_w2,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
create table tmp (
-a varchar(50) charset utf16 collate utf16_general_ci,
-b varchar(50) charset utf16 collate utf16_general_ci unique key,
-c varchar(50) charset utf16 collate utf16_general_ci primary key
+a varchar(150) charset ucs2 collate ucs2_general_ci,
+b text(150) charset ucs2 collate ucs2_general_ci,
+unique key b_idx (b(150))
) engine=innodb;
alter table tmp
-change a a varchar(50) charset utf16 collate utf16_german2_ci,
+change a a varchar(150) charset utf16 collate utf16_unicode_nopad_ci,
algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify b varchar(50) charset utf16 collate utf16_german2_ci,
+modify b text charset utf16 collate utf16_unicode_nopad_ci,
+algorithm=instant;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+drop table tmp;
+create table tmp (
+a varchar(150) charset ucs2 collate ucs2_general_mysql500_ci,
+b text(150) charset ucs2 collate ucs2_general_mysql500_ci,
+unique key b_idx (b(150))
+) engine=innodb;
+alter table tmp
+change a a varchar(150) charset utf16 collate utf16_spanish2_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
alter table tmp
-modify c varchar(50) charset utf16 collate utf16_german2_ci,
+modify b text charset utf16 collate utf16_spanish2_ci,
algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
-drop table compatible_without_index;
-create table fully_incompatible (
-id int auto_increment unique key,
-from_charset char(255),
-from_collate char(255),
-to_charset char(255),
-to_collate char(255)
-);
-insert into fully_incompatible (from_charset, from_collate, to_charset, to_collate) values
-('utf8mb4', 'utf8mb4_general_ci', 'utf8mb3', 'utf8mb3_general_ci'),
-('utf8mb4', 'utf8mb4_general_ci', 'ascii', 'ascii_general_ci'),
-('utf8mb3', 'utf8mb3_general_ci', 'ascii', 'ascii_general_ci'),
-('utf8mb3', 'utf8mb3_general_ci', 'latin1', 'latin1_general_ci'),
-('utf16', 'utf16_general_ci', 'utf32', 'utf32_general_ci'),
-('latin1', 'latin1_general_ci', 'ascii', 'ascii_general_ci'),
-('ascii', 'ascii_general_ci', 'swe7', 'swe7_swedish_ci'),
-('eucjpms', 'eucjpms_japanese_nopad_ci', 'geostd8', 'geostd8_general_ci'),
-('latin1', 'latin1_general_ci', 'utf16', 'utf16_general_ci')
-;
create table tmp (
a varchar(150) charset utf8mb4 collate utf8mb4_general_ci,
b text(150) charset utf8mb4 collate utf8mb4_general_ci,
@@ -1810,3 +1773,42 @@ algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
drop table tmp;
drop table fully_incompatible;
+#
+# MDEV-19284 INSTANT ALTER with ucs2-to-utf16 conversion produces bad data
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2, PRIMARY KEY(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('a'),(0xD800);
+ALTER TABLE t1 ALGORITHM=COPY, MODIFY a VARCHAR(10) CHARACTER SET utf16;
+ERROR 22007: Incorrect string value: '\xD8\x00' for column `test`.`t1`.`a` at row 2
+ALTER TABLE t1 ALGORITHM=INSTANT, MODIFY a VARCHAR(10) CHARACTER SET utf16;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+ALTER IGNORE TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16;
+affected rows: 2
+info: Records: 2 Duplicates: 0 Warnings: 1
+Warnings:
+Warning 1366 Incorrect string value: '\xD8\x00' for column `test`.`t1`.`a` at row 2
+SELECT HEX(a) FROM t1;
+HEX(a)
+003F
+0061
+DROP TABLE t1;
+#
+# MDEV-19285 INSTANT ALTER from ascii_general_ci to latin1_general_ci produces currupt data
+#
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ascii COLLATE ascii_general_ci, PRIMARY KEY(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('a'),(0xC0),('b');
+ALTER TABLE t1 ALGORITHM=COPY, MODIFY a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_general_ci;
+ERROR 22007: Incorrect string value: '\xC0' for column `test`.`t1`.`a` at row 3
+ALTER TABLE t1 ALGORITHM=INSTANT, MODIFY a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_general_ci;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
+ALTER IGNORE TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_general_ci;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 1
+Warnings:
+Warning 1366 Incorrect string value: '\xC0' for column `test`.`t1`.`a` at row 3
+SELECT HEX(a) FROM t1;
+HEX(a)
+3F
+61
+62
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/instant_alter_charset.test b/mysql-test/suite/innodb/t/instant_alter_charset.test
index 82ab9f9eb94..9335e4a5139 100644
--- a/mysql-test/suite/innodb/t/instant_alter_charset.test
+++ b/mysql-test/suite/innodb/t/instant_alter_charset.test
@@ -20,9 +20,13 @@ select c.prtype, c.len from information_schema.innodb_sys_columns as c inner joi
alter table no_rebuild
change a a char(150) charset utf8mb3 collate utf8mb3_spanish_ci,
algorithm=inplace;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table rebuild
change a a varchar(150) charset latin1 not null default 'asdf',
algorithm=inplace;
+alter table rebuild
+ change a a varchar(150) charset latin1 not null default 'asdf',
+ algorithm=copy;
select name, prtype, len from information_schema.innodb_sys_columns
where table_id = @id;
select c.prtype, c.len from information_schema.innodb_sys_columns as c inner join information_schema.innodb_sys_tables t on c.table_id = t.table_id
@@ -41,7 +45,7 @@ create table supported_types (
) engine=innodb;
alter table supported_types
- convert to charset latin1,
+ convert to charset ascii collate ascii_bin,
algorithm=instant;
drop table supported_types;
@@ -53,7 +57,7 @@ create table various_cases (
) engine=innodb;
alter table various_cases
- change a a char(150) charset latin1,
+ change a a char(150) charset ascii collate ascii_bin,
algorithm=inplace;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
@@ -88,7 +92,7 @@ create table all_texts (
) engine=innodb;
alter table all_texts
- convert to charset latin1 collate latin1_general_ci,
+ convert to charset ascii collate ascii_bin,
algorithm=instant;
drop table all_texts;
@@ -244,10 +248,15 @@ alter table latin1_swedish_special_case
modify copy1 varchar(150) charset latin1 collate latin1_swedish_ci,
modify copy2 char(150) charset latin1 collate latin1_swedish_ci,
algorithm=copy;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table latin1_swedish_special_case
modify instant1 varchar(150) charset latin1 collate latin1_swedish_ci,
modify instant2 char(150) charset latin1 collate latin1_swedish_ci,
algorithm=instant;
+alter table latin1_swedish_special_case
+ modify instant1 varchar(150) charset latin1 collate latin1_swedish_ci,
+ modify instant2 char(150) charset latin1 collate latin1_swedish_ci,
+ algorithm=copy;
select c.name, c.prtype, c.mtype, c.len from information_schema.innodb_sys_columns as c inner join information_schema.innodb_sys_tables t on c.table_id = t.table_id
where t.name = 'test/latin1_swedish_special_case';
alter table latin1_swedish_special_case
@@ -275,11 +284,16 @@ create table boundary_255 (
c varchar(300) charset ascii
) engine=innodb;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table boundary_255
modify a varchar(50) charset utf8mb3,
algorithm=instant;
+alter table boundary_255
+ modify a varchar(50) charset utf8mb3,
+ algorithm=copy;
if ($row_format == 'redundant') {
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table boundary_255
modify b varchar(200) charset utf8mb3,
algorithm=instant;
@@ -291,6 +305,7 @@ alter table boundary_255
algorithm=instant;
}
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table boundary_255
modify c varchar(300) charset utf8mb3,
algorithm=instant;
@@ -338,30 +353,7 @@ insert into fully_compatible (from_charset, from_collate, to_charset, to_collate
('utf8mb3', 'utf8mb3_general_nopad_ci', 'utf8mb4', 'utf8mb4_general_nopad_ci'),
('utf8mb3', 'utf8mb3_nopad_bin', 'utf8mb4', 'utf8mb4_nopad_bin'),
('utf8mb3', 'utf8mb3_unicode_nopad_ci', 'utf8mb4', 'utf8mb4_unicode_nopad_ci'),
- ('utf8mb3', 'utf8mb3_unicode_520_nopad_ci', 'utf8mb4', 'utf8mb4_unicode_520_nopad_ci'),
-
- ('ucs2', 'ucs2_general_ci', 'utf16', 'utf16_general_ci'),
- ('ucs2', 'ucs2_unicode_ci', 'utf16', 'utf16_unicode_ci'),
- ('ucs2', 'ucs2_icelandic_ci', 'utf16', 'utf16_icelandic_ci'),
- ('ucs2', 'ucs2_latvian_ci', 'utf16', 'utf16_latvian_ci'),
- ('ucs2', 'ucs2_romanian_ci', 'utf16', 'utf16_romanian_ci'),
- ('ucs2', 'ucs2_slovenian_ci', 'utf16', 'utf16_slovenian_ci'),
- ('ucs2', 'ucs2_polish_ci', 'utf16', 'utf16_polish_ci'),
- ('ucs2', 'ucs2_estonian_ci', 'utf16', 'utf16_estonian_ci'),
- ('ucs2', 'ucs2_spanish_ci', 'utf16', 'utf16_spanish_ci'),
- ('ucs2', 'ucs2_general_ci', 'utf16', 'utf16_general_ci'),
-
- ('ascii', 'ascii_general_ci', 'utf8mb3', 'utf8mb3_general_ci'),
- ('ascii', 'ascii_general_ci', 'utf8mb4', 'utf8mb4_general_ci'),
- ('ascii', 'ascii_general_ci', 'latin1', 'latin1_general_ci'),
- ('ascii', 'ascii_bin', 'latin1', 'latin1_bin'),
- ('ascii', 'ascii_nopad_bin', 'latin1', 'latin1_nopad_bin'),
- ('ascii', 'ascii_general_ci', 'latin2', 'latin2_general_ci'),
- ('ascii', 'ascii_general_ci', 'latin7', 'latin7_general_ci'),
- ('ascii', 'ascii_bin', 'koi8u', 'koi8u_bin'),
- ('ascii', 'ascii_bin', 'ujis', 'ujis_bin'),
- ('ascii', 'ascii_bin', 'big5', 'big5_bin'),
- ('ascii', 'ascii_bin', 'gbk', 'gbk_bin')
+ ('utf8mb3', 'utf8mb3_unicode_520_nopad_ci', 'utf8mb4', 'utf8mb4_unicode_520_nopad_ci')
;
let $data_size = `select count(*) from fully_compatible`;
@@ -404,47 +396,19 @@ create table compatible_without_index (
);
insert into compatible_without_index (from_charset, from_collate, to_charset, to_collate) values
- ('ascii', 'ascii_general_ci', 'utf8mb3', 'utf8mb3_swedish_ci'),
- ('ascii', 'ascii_bin', 'latin1', 'latin1_swedish_ci'),
- ('ascii', 'ascii_general_nopad_ci', 'latin1', 'latin1_swedish_ci'),
- ('ascii', 'ascii_nopad_bin', 'latin1', 'latin1_swedish_ci'),
-
- ('ascii', 'ascii_general_ci', 'koi8u', 'koi8u_bin'),
- ('ascii', 'ascii_general_nopad_ci', 'koi8u', 'koi8u_bin'),
- ('ascii', 'ascii_nopad_bin', 'koi8u', 'koi8u_bin'),
-
- ('ascii', 'ascii_general_ci', 'latin1', 'latin1_swedish_ci'),
- ('ascii', 'ascii_bin', 'utf8mb3', 'utf8mb3_swedish_ci'),
- ('ascii', 'ascii_general_nopad_ci', 'utf8mb3', 'utf8mb3_swedish_ci'),
- ('ascii', 'ascii_nopad_bin', 'utf8mb3', 'utf8mb3_swedish_ci'),
-
- ('ascii', 'ascii_general_ci', 'utf8mb4', 'utf8mb4_danish_ci'),
- ('ascii', 'ascii_bin', 'utf8mb4', 'utf8mb4_danish_ci'),
- ('ascii', 'ascii_general_nopad_ci', 'utf8mb4', 'utf8mb4_danish_ci'),
- ('ascii', 'ascii_nopad_bin', 'utf8mb4', 'utf8mb4_danish_ci'),
('utf8mb3', 'utf8mb3_general_ci', 'utf8mb4', 'utf8mb4_vietnamese_ci'),
('utf8mb3', 'utf8mb3_bin', 'utf8mb4', 'utf8mb4_vietnamese_ci'),
('utf8mb3', 'utf8mb3_general_nopad_ci', 'utf8mb4', 'utf8mb4_vietnamese_ci'),
('utf8mb3', 'utf8mb3_nopad_bin', 'utf8mb4', 'utf8mb4_vietnamese_ci'),
- ('ascii', 'ascii_general_ci', 'gbk', 'gbk_chinese_ci'),
- ('ascii', 'ascii_general_ci', 'gbk', 'gbk_chinese_nopad_ci'),
-
- ('ucs2', 'ucs2_myanmar_ci', 'utf16', 'utf16_thai_520_w2'),
- ('ucs2', 'ucs2_general_ci', 'utf16', 'utf16_unicode_nopad_ci'),
- ('ucs2', 'ucs2_general_mysql500_ci', 'utf16', 'utf16_spanish2_ci'),
-
('ascii', 'ascii_general_ci', 'ascii', 'ascii_bin'),
('utf8mb3', 'utf8mb3_roman_ci', 'utf8mb3', 'utf8mb3_lithuanian_ci'),
('utf8mb4', 'utf8mb4_thai_520_w2', 'utf8mb4', 'utf8mb4_persian_ci'),
('utf8mb3', 'utf8mb3_myanmar_ci', 'utf8mb4', 'utf8mb4_german2_ci'),
('utf8mb3', 'utf8mb3_general_ci', 'utf8mb3', 'utf8mb3_unicode_ci'),
('latin1', 'latin1_general_cs', 'latin1', 'latin1_general_ci'),
- ('ascii', 'ascii_general_ci', 'ujis', 'ujis_japanese_ci'),
- ('ascii', 'ascii_general_ci', 'big5', 'big5_chinese_ci'),
- ('ascii', 'ascii_general_ci', 'latin2', 'latin2_croatian_ci'),
- ('ascii', 'ascii_general_ci', 'latin7', 'latin7_estonian_cs'),
+
('utf16', 'utf16_general_ci', 'utf16', 'utf16_german2_ci')
;
@@ -494,6 +458,59 @@ create table fully_incompatible (
);
insert into fully_incompatible (from_charset, from_collate, to_charset, to_collate) values
+ ('ascii', 'ascii_general_ci', 'utf8mb3', 'utf8mb3_general_ci'),
+ ('ascii', 'ascii_general_ci', 'utf8mb4', 'utf8mb4_general_ci'),
+ ('ascii', 'ascii_general_ci', 'latin1', 'latin1_general_ci'),
+ ('ascii', 'ascii_bin', 'latin1', 'latin1_bin'),
+ ('ascii', 'ascii_nopad_bin', 'latin1', 'latin1_nopad_bin'),
+ ('ascii', 'ascii_general_ci', 'latin2', 'latin2_general_ci'),
+ ('ascii', 'ascii_general_ci', 'latin7', 'latin7_general_ci'),
+ ('ascii', 'ascii_bin', 'koi8u', 'koi8u_bin'),
+ ('ascii', 'ascii_bin', 'ujis', 'ujis_bin'),
+ ('ascii', 'ascii_bin', 'big5', 'big5_bin'),
+ ('ascii', 'ascii_bin', 'gbk', 'gbk_bin'),
+
+ ('ascii', 'ascii_general_ci', 'utf8mb3', 'utf8mb3_swedish_ci'),
+ ('ascii', 'ascii_bin', 'latin1', 'latin1_swedish_ci'),
+ ('ascii', 'ascii_general_nopad_ci', 'latin1', 'latin1_swedish_ci'),
+ ('ascii', 'ascii_nopad_bin', 'latin1', 'latin1_swedish_ci'),
+
+ ('ascii', 'ascii_general_ci', 'koi8u', 'koi8u_bin'),
+ ('ascii', 'ascii_general_nopad_ci', 'koi8u', 'koi8u_bin'),
+ ('ascii', 'ascii_nopad_bin', 'koi8u', 'koi8u_bin'),
+
+ ('ascii', 'ascii_general_ci', 'latin1', 'latin1_swedish_ci'),
+ ('ascii', 'ascii_bin', 'utf8mb3', 'utf8mb3_swedish_ci'),
+ ('ascii', 'ascii_general_nopad_ci', 'utf8mb3', 'utf8mb3_swedish_ci'),
+ ('ascii', 'ascii_nopad_bin', 'utf8mb3', 'utf8mb3_swedish_ci'),
+
+ ('ascii', 'ascii_general_ci', 'utf8mb4', 'utf8mb4_danish_ci'),
+ ('ascii', 'ascii_bin', 'utf8mb4', 'utf8mb4_danish_ci'),
+ ('ascii', 'ascii_general_nopad_ci', 'utf8mb4', 'utf8mb4_danish_ci'),
+ ('ascii', 'ascii_nopad_bin', 'utf8mb4', 'utf8mb4_danish_ci'),
+
+ ('ascii', 'ascii_general_ci', 'gbk', 'gbk_chinese_ci'),
+ ('ascii', 'ascii_general_ci', 'gbk', 'gbk_chinese_nopad_ci'),
+
+ ('ascii', 'ascii_general_ci', 'ujis', 'ujis_japanese_ci'),
+ ('ascii', 'ascii_general_ci', 'big5', 'big5_chinese_ci'),
+ ('ascii', 'ascii_general_ci', 'latin2', 'latin2_croatian_ci'),
+ ('ascii', 'ascii_general_ci', 'latin7', 'latin7_estonian_cs'),
+
+ ('ucs2', 'ucs2_general_ci', 'utf16', 'utf16_general_ci'),
+ ('ucs2', 'ucs2_unicode_ci', 'utf16', 'utf16_unicode_ci'),
+ ('ucs2', 'ucs2_icelandic_ci', 'utf16', 'utf16_icelandic_ci'),
+ ('ucs2', 'ucs2_latvian_ci', 'utf16', 'utf16_latvian_ci'),
+ ('ucs2', 'ucs2_romanian_ci', 'utf16', 'utf16_romanian_ci'),
+ ('ucs2', 'ucs2_slovenian_ci', 'utf16', 'utf16_slovenian_ci'),
+ ('ucs2', 'ucs2_polish_ci', 'utf16', 'utf16_polish_ci'),
+ ('ucs2', 'ucs2_estonian_ci', 'utf16', 'utf16_estonian_ci'),
+ ('ucs2', 'ucs2_spanish_ci', 'utf16', 'utf16_spanish_ci'),
+ ('ucs2', 'ucs2_general_ci', 'utf16', 'utf16_general_ci'),
+ ('ucs2', 'ucs2_myanmar_ci', 'utf16', 'utf16_thai_520_w2'),
+ ('ucs2', 'ucs2_general_ci', 'utf16', 'utf16_unicode_nopad_ci'),
+ ('ucs2', 'ucs2_general_mysql500_ci', 'utf16', 'utf16_spanish2_ci'),
+
('utf8mb4', 'utf8mb4_general_ci', 'utf8mb3', 'utf8mb3_general_ci'),
('utf8mb4', 'utf8mb4_general_ci', 'ascii', 'ascii_general_ci'),
('utf8mb3', 'utf8mb3_general_ci', 'ascii', 'ascii_general_ci'),
@@ -536,3 +553,33 @@ while ($counter <= $data_size) {
}
drop table fully_incompatible;
+
+--echo #
+--echo # MDEV-19284 INSTANT ALTER with ucs2-to-utf16 conversion produces bad data
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2, PRIMARY KEY(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('a'),(0xD800);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+ALTER TABLE t1 ALGORITHM=COPY, MODIFY a VARCHAR(10) CHARACTER SET utf16;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+ALTER TABLE t1 ALGORITHM=INSTANT, MODIFY a VARCHAR(10) CHARACTER SET utf16;
+--enable_info ONCE
+ALTER IGNORE TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16;
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-19285 INSTANT ALTER from ascii_general_ci to latin1_general_ci produces currupt data
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ascii COLLATE ascii_general_ci, PRIMARY KEY(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('a'),(0xC0),('b');
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+ALTER TABLE t1 ALGORITHM=COPY, MODIFY a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_general_ci;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+ALTER TABLE t1 ALGORITHM=INSTANT, MODIFY a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_general_ci;
+--enable_info ONCE
+ALTER IGNORE TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_general_ci;
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
diff --git a/sql/field.cc b/sql/field.cc
index 72dc52143a0..f87b90bb484 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -7079,6 +7079,17 @@ int Field_str::store(double nr)
}
+bool Field_longstr::
+ csinfo_change_allows_instant_alter(const Create_field *to) const
+{
+ Charset cs(field_charset);
+ const bool part_of_a_key= !to->field->part_of_key.is_clear_all();
+ return part_of_a_key ?
+ cs.encoding_and_order_allow_reinterpret_as(to->charset) :
+ cs.encoding_allows_reinterpret_as(to->charset);
+}
+
+
uint Field_string::is_equal(Create_field *new_field)
{
DBUG_ASSERT(!compression_method());
@@ -7089,9 +7100,7 @@ uint Field_string::is_equal(Create_field *new_field)
if (new_field->char_length < char_length())
return IS_EQUAL_NO;
- const bool part_of_a_key= !new_field->field->part_of_key.is_clear_all();
- if (!Type_handler::Charsets_are_compatible(field_charset, new_field->charset,
- part_of_a_key))
+ if (!csinfo_change_allows_instant_alter(new_field))
return IS_EQUAL_NO;
if (new_field->length == max_display_length())
@@ -7941,9 +7950,7 @@ uint Field_varstring::is_equal(Create_field *new_field)
if (!new_field->compression_method() != !compression_method())
return IS_EQUAL_NO;
- bool part_of_a_key= !new_field->field->part_of_key.is_clear_all();
- if (!Type_handler::Charsets_are_compatible(field_charset, new_field->charset,
- part_of_a_key))
+ if (!csinfo_change_allows_instant_alter(new_field))
return IS_EQUAL_NO;
const Type_handler *new_type_handler= new_field->type_handler();
@@ -8738,12 +8745,8 @@ uint Field_blob::is_equal(Create_field *new_field)
return IS_EQUAL_NO;
}
- bool part_of_a_key= !new_field->field->part_of_key.is_clear_all();
- if (!Type_handler::Charsets_are_compatible(field_charset, new_field->charset,
- part_of_a_key))
- {
+ if (!csinfo_change_allows_instant_alter(new_field))
return IS_EQUAL_NO;
- }
if (field_charset != new_field->charset)
{
diff --git a/sql/field.h b/sql/field.h
index 35597d72927..57d9c4f3409 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1923,6 +1923,7 @@ class Field_longstr :public Field_str
CHARSET_INFO *cs, size_t nchars);
String *uncompress(String *val_buffer, String *val_ptr,
const uchar *from, uint from_length);
+ bool csinfo_change_allows_instant_alter(const Create_field *to) const;
public:
Field_longstr(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
diff --git a/sql/sql_string.h b/sql/sql_string.h
index fa941c8156e..67b27e52bb5 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -159,6 +159,14 @@ class Charset
{
swap_variables(CHARSET_INFO*, m_charset, other.m_charset);
}
+ /*
+ Collation name without the character set name.
+ For example, in case of "latin1_swedish_ci",
+ this method returns "_swedish_ci".
+ */
+ LEX_CSTRING collation_specific_name() const;
+ bool encoding_allows_reinterpret_as(CHARSET_INFO *cs) const;
+ bool encoding_and_order_allow_reinterpret_as(CHARSET_INFO *cs) const;
};
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index 4906eee064d..85d1f5ae843 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -8206,48 +8206,55 @@ Type_handler_timestamp_common::Item_param_val_native(THD *thd,
TIME_to_native(thd, <ime, to, item->datetime_precision(thd));
}
-static bool charsets_are_compatible(const char *old_cs_name,
- const CHARSET_INFO *new_ci)
-{
- const char *new_cs_name= new_ci->csname;
- if (!strcmp(old_cs_name, new_cs_name))
- return true;
+LEX_CSTRING Charset::collation_specific_name() const
+{
+ /*
+ User defined collations can provide arbitrary names
+ for character sets and collations, so a collation
+ name not necessarily starts with the character set name.
+ */
+ size_t csname_length= strlen(m_charset->csname);
+ if (strncmp(m_charset->name, m_charset->csname, csname_length))
+ return {NULL, 0};
+ const char *ptr= m_charset->name + csname_length;
+ return {ptr, strlen(ptr) };
+}
- if (!strcmp(old_cs_name, MY_UTF8MB3) && !strcmp(new_cs_name, MY_UTF8MB4))
- return true;
- if (!strcmp(old_cs_name, "ascii") && !(new_ci->state & MY_CS_NONASCII))
+bool
+Charset::encoding_allows_reinterpret_as(const CHARSET_INFO *cs) const
+{
+ if (!strcmp(m_charset->csname, cs->csname))
return true;
- if (!strcmp(old_cs_name, "ucs2") && !strcmp(new_cs_name, "utf16"))
+ if (!strcmp(m_charset->csname, MY_UTF8MB3) &&
+ !strcmp(cs->csname, MY_UTF8MB4))
return true;
+ /*
+ Originally we allowed here instat ALTER for ASCII-to-LATIN1
+ and UCS2-to-UTF16, but this was wrong:
+ - MariaDB's ascii is not a subset for 8-bit character sets
+ like latin1, because it allows storing bytes 0x80..0xFF as
+ "unassigned" characters (see MDEV-19285).
+ - MariaDB's ucs2 (as in Uncode-1.1) is not a subset for UTF16,
+ because they treat surrogate codes differently (MDEV-19284).
+ */
return false;
}
-bool Type_handler::Charsets_are_compatible(const CHARSET_INFO *old_ci,
- const CHARSET_INFO *new_ci,
- bool part_of_a_key)
-{
- const char *old_cs_name= old_ci->csname;
- const char *new_cs_name= new_ci->csname;
-
- if (!charsets_are_compatible(old_cs_name, new_ci))
- {
- return false;
- }
-
- if (!part_of_a_key)
- {
- return true;
- }
- if (strcmp(old_ci->name + strlen(old_cs_name),
- new_ci->name + strlen(new_cs_name)))
- {
+bool
+Charset::encoding_and_order_allow_reinterpret_as(CHARSET_INFO *cs)
+ const
+{
+ if (!encoding_allows_reinterpret_as(cs))
return false;
- }
-
- return true;
+ LEX_CSTRING name0= collation_specific_name();
+ LEX_CSTRING name1= Charset(cs).collation_specific_name();
+ return
+ name0.length &&
+ name0.length == name1.length &&
+ !memcmp(name0.str, name1.str, name0.length);
}
diff --git a/sql/sql_type.h b/sql/sql_type.h
index da9913c1265..feb5c45c965 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -3697,10 +3697,6 @@ class Type_handler
virtual bool
Vers_history_point_resolve_unit(THD *thd, Vers_history_point *point) const;
-
- static bool Charsets_are_compatible(const CHARSET_INFO *old_ci,
- const CHARSET_INFO *new_ci,
- bool part_of_a_key);
};
Follow ups
References