-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-22771 Instant extension of CHAR column is wrongly allowed
commit 854c219 (MDEV-17301) broke a constraint: Fixed-length columns cannot be extended in InnoDB without rebuilding the table. ha_innobase::can_convert_string(): Correct the condition. We must not allow any instantaneous change to the length of CHAR columns measured in characters. For any format other than ROW_FORMAT=REDUNDANT, we can allow the length in bytes to be extended if mbminlen<mbmaxlen held before the change of the character set.
- Loading branch information
Showing
4 changed files
with
50 additions
and
40 deletions.
There are no files selected for viewing
31 changes: 20 additions & 11 deletions
31
mysql-test/suite/innodb/r/instant_alter_extend,utf8.rdiff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,38 @@ | ||
--- instant_alter_convert.result | ||
+++ instant_alter_convert,utf8.result | ||
@@ -37,7 +37,7 @@ | ||
test.t check status OK | ||
@@ -38,7 +38,7 @@ | ||
best.t check status OK | ||
call check_table('t'); | ||
name mtype prtype len | ||
-a 2 800FE 200 | ||
+a 13 2100FE 600 | ||
# CHAR enlargement | ||
alter table t modify a char(220), algorithm=instant; | ||
select count(a) from t where a = @bigval; | ||
@@ -51,7 +51,7 @@ | ||
test.t check status OK | ||
alter table t modify a char(220); | ||
affected rows: 2 | ||
@@ -54,7 +54,7 @@ | ||
best.t check status OK | ||
call check_table('t'); | ||
name mtype prtype len | ||
-a 2 800FE 220 | ||
+a 13 2100FE 660 | ||
ALTER TABLE t CHANGE COLUMN a a CHAR(230) BINARY; | ||
affected rows: 2 | ||
info: Records: 2 Duplicates: 0 Warnings: 0 | ||
@@ -69,7 +69,7 @@ | ||
best.t check status OK | ||
call check_table('t'); | ||
name mtype prtype len | ||
-a 13 2F00FE 230 | ||
+a 13 5300FE 690 | ||
# Convert from VARCHAR to a bigger CHAR | ||
alter table t modify a varchar(200), algorithm=instant; | ||
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY | ||
@@ -72,7 +72,7 @@ | ||
test.t check status OK | ||
alter table t modify a varchar(200); | ||
affected rows: 2 | ||
@@ -92,7 +92,7 @@ | ||
best.t check status OK | ||
call check_table('t'); | ||
name mtype prtype len | ||
-a 2 800FE 255 | ||
+a 13 2100FE 765 | ||
# BINARY/VARBINARY test | ||
create or replace table t (a varbinary(300)); | ||
alter table t modify a binary(255), algorithm=instant; | ||
insert into t values(NULL); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters