mirror of
https://github.com/MariaDB/server.git
synced 2025-08-17 06:42:17 +03:00
DROP DATABASE would internally execute DROP TABLE on every contained table and finally remove the directory. In InnoDB, DROP TABLE is sometimes executed in the background. The table would be renamed to a name that starts with #sql. The existence of these files would prevent DROP DATABASE from succeeding. CREATE OR REPLACE DATABASE can internally execute DROP DATABASE if the directory already exists. This could fail due to the InnoDB background DROP TABLE, possibly due to some tables that were leftovers from earlier tests.
306 lines
8.5 KiB
Plaintext
306 lines
8.5 KiB
Plaintext
#
|
||
# MDEV-15563: Instant ROW_FORMAT=REDUNDANT column type change&extension
|
||
# (reverted in MDEV-18627)
|
||
#
|
||
create database best;
|
||
use best;
|
||
set default_storage_engine=innodb;
|
||
set @bigval= repeat('0123456789', 30);
|
||
create procedure check_table(table_name varchar(255))
|
||
begin
|
||
select table_id into @table_id
|
||
from information_schema.innodb_sys_tables
|
||
where name = concat('best/', table_name);
|
||
select name, mtype, hex(prtype) as prtype, len
|
||
from information_schema.innodb_sys_columns
|
||
where table_id = @table_id;
|
||
end~~
|
||
# VARCHAR -> CHAR, VARBINARY -> BINARY conversion
|
||
set @bigval= repeat('0123456789', 20);
|
||
create table t (a varchar(300));
|
||
alter table t modify a char(255), algorithm=instant;
|
||
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
|
||
alter table t modify a char(255), algorithm=copy;
|
||
create or replace table t (a varchar(200));
|
||
insert into t values (@bigval);
|
||
insert into t values ('z');
|
||
alter table t modify a char(200);
|
||
affected rows: 2
|
||
info: Records: 2 Duplicates: 0 Warnings: 0
|
||
select count(a) from t where a = @bigval;
|
||
count(a)
|
||
1
|
||
select a, length(a) from t where a = 'z';
|
||
a length(a)
|
||
z 1
|
||
check table t extended;
|
||
Table Op Msg_type Msg_text
|
||
best.t check status OK
|
||
call check_table('t');
|
||
name mtype prtype len
|
||
a 2 800FE 200
|
||
# CHAR enlargement
|
||
alter table t modify a char(220);
|
||
affected rows: 2
|
||
info: Records: 2 Duplicates: 0 Warnings: 0
|
||
select count(a) from t where a = @bigval;
|
||
count(a)
|
||
1
|
||
select a, length(a) from t where a = 'z';
|
||
a length(a)
|
||
z 1
|
||
check table t extended;
|
||
Table Op Msg_type Msg_text
|
||
best.t check status OK
|
||
call check_table('t');
|
||
name mtype prtype len
|
||
a 2 800FE 220
|
||
# Convert from VARCHAR to a bigger CHAR
|
||
alter table t modify a varchar(200);
|
||
affected rows: 2
|
||
info: Records: 2 Duplicates: 0 Warnings: 0
|
||
alter table t modify a char(255);
|
||
affected rows: 2
|
||
info: Records: 2 Duplicates: 0 Warnings: 0
|
||
select count(a) from t where a = @bigval;
|
||
count(a)
|
||
1
|
||
select a, length(a) from t where a = 'z';
|
||
a length(a)
|
||
z 1
|
||
select * from t;
|
||
a
|
||
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
||
z
|
||
check table t extended;
|
||
Table Op Msg_type Msg_text
|
||
best.t check status OK
|
||
call check_table('t');
|
||
name mtype prtype len
|
||
a 2 800FE 255
|
||
# BINARY/VARBINARY test
|
||
create or replace table t (a varbinary(300));
|
||
insert into t values(NULL);
|
||
alter table t modify a binary(255);
|
||
affected rows: 1
|
||
info: Records: 1 Duplicates: 0 Warnings: 0
|
||
create or replace table t (a varbinary(200));
|
||
insert into t values (@bigval);
|
||
insert into t values ('z');
|
||
alter table t modify a binary(200);
|
||
affected rows: 2
|
||
info: Records: 2 Duplicates: 0 Warnings: 0
|
||
select count(a) from t where a = @bigval;
|
||
count(a)
|
||
1
|
||
select length(a) from t where left(a, 1) = 'z';
|
||
length(a)
|
||
200
|
||
check table t extended;
|
||
Table Op Msg_type Msg_text
|
||
best.t check status OK
|
||
call check_table('t');
|
||
name mtype prtype len
|
||
a 3 3F04FE 200
|
||
# BINARY enlargement
|
||
alter table t modify a binary(220);
|
||
affected rows: 2
|
||
info: Records: 2 Duplicates: 0 Warnings: 0
|
||
check table t extended;
|
||
Table Op Msg_type Msg_text
|
||
best.t check status OK
|
||
call check_table('t');
|
||
name mtype prtype len
|
||
a 3 3F04FE 220
|
||
# Convert from VARBINARY to a bigger BINARY
|
||
alter table t modify a varbinary(220);
|
||
affected rows: 2
|
||
info: Records: 2 Duplicates: 0 Warnings: 0
|
||
alter table t modify a binary(255);
|
||
affected rows: 2
|
||
info: Records: 2 Duplicates: 0 Warnings: 0
|
||
select count(a) from t where a = @bigval;
|
||
count(a)
|
||
0
|
||
select a, length(a) from t where a = 'z';
|
||
a length(a)
|
||
select * from t;
|
||
a
|
||
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 |