mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-28933 CREATE OR REPLACE fails to recreate same constraint name
Use temporary constraint names for temporary tables. The constraints are not added to cache (skipped in dict_table_rename_in_cache()). The scheme for temporary constraint names is as follows: for old table: db_name/\xFFconstraint_name for new table: db_name/\xFF\xFFconstraint_name normalize_table_name_c_low(): wrong comparison "less than FN_REFLEN - 1". Somewhere array of FN_REFLEN includes the trailing 0, somewhere array of FN_REFLEN + 1 includes trailing 0, but nowhere array of FN_REFLEN - 1 must include trailing 0.
This commit is contained in:
@ -655,3 +655,25 @@ select * from t2;
|
||||
unlock tables;
|
||||
|
||||
drop tables t2, t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-28933 CREATE OR REPLACE fails to recreate same constraint name
|
||||
--echo #
|
||||
use test;
|
||||
create table t (a int primary key) engine=innodb;
|
||||
create or replace table u (
|
||||
a int primary key,
|
||||
constraint c foreign key d (a) references t (a)) engine=innodb;
|
||||
|
||||
select * from information_schema.innodb_sys_foreign;
|
||||
select * from information_schema.innodb_sys_foreign_cols;
|
||||
|
||||
create or replace table u (
|
||||
a int primary key,
|
||||
constraint c foreign key d (a) references t (a)) engine=innodb;
|
||||
|
||||
select * from information_schema.innodb_sys_foreign;
|
||||
select * from information_schema.innodb_sys_foreign_cols;
|
||||
drop tables u, t;
|
||||
select * from information_schema.innodb_sys_foreign;
|
||||
select * from information_schema.innodb_sys_foreign_cols;
|
||||
|
Reference in New Issue
Block a user