mirror of
https://github.com/MariaDB/server.git
synced 2025-07-24 19:42:23 +03:00
dict_table_rename_in_cache(), dict_table_get_highest_foreign_id(): Reserve sufficient space for the fkid[] buffer, and ensure that the fkid[] will be NUL-terminated. The fkid[] must accommodate both the database name (which is already encoded in my_charset_filename) and the constraint name (which must be converted to my_charset_filename) so that we can check if it is in the format databasename/tablename_ibfk_1 (all encoded in my_charset_filename).
78 lines
2.8 KiB
Plaintext
78 lines
2.8 KiB
Plaintext
--source include/have_innodb.inc
|
|
# On Microsoft Windows, there is an additional limit of MAX_PATH
|
|
--source include/not_windows.inc
|
|
# The embedded server prepends --datadir or --innodb-data-home-dir
|
|
# to the path names, which reduces the maximum length of names further.
|
|
--source include/not_embedded.inc
|
|
|
|
--echo #
|
|
--echo # MDEV-28980 InnoDB: Failing assertion: len <= MAX_TABLE_NAME_LEN
|
|
--echo #
|
|
|
|
# The main test is innodb.foreign_key. This is an additional test that
|
|
# the maximum length cannot be exceeded for implicitly created
|
|
# constraint names. On Microsoft Windows, MAX_PATH is a much stricter
|
|
# limit than the 255-byte maximum path component length on many other systems,
|
|
# including Linux and IBM AIX.
|
|
|
|
CREATE TABLE t (a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
|
|
# The maximum identifier length is 64 characters.
|
|
# my_charset_filename will expand some characters to 5 characters,
|
|
# e.g., # to @0023.
|
|
# Many operating systems (such as Linux) or file systems
|
|
# limit the path component length to 255 bytes,
|
|
# corresponding to the 51 characters below: 5*51=255.
|
|
let $d255=###################################################;
|
|
let $d250=##################################################;
|
|
--replace_result $d255 d255
|
|
eval CREATE DATABASE `$d255`;
|
|
--replace_result $d255 d255
|
|
--error ER_IDENT_CAUSES_TOO_LONG_PATH
|
|
eval CREATE TABLE `$d255`.`$d255`
|
|
(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB;
|
|
--replace_result $d255 d255
|
|
--error ER_IDENT_CAUSES_TOO_LONG_PATH
|
|
eval CREATE TABLE `$d255`.`_$d250`
|
|
(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB;
|
|
--replace_result $d255 d255
|
|
eval CREATE TABLE `$d255`.`$d250`
|
|
(a INT PRIMARY KEY, FOREIGN KEY(a) REFERENCES test.t(a)) ENGINE=InnoDB;
|
|
|
|
--echo #
|
|
--echo # MDEV-29258 Failing assertion for name length on RENAME TABLE
|
|
--echo #
|
|
|
|
let $d245=-------------------------------------------------;
|
|
--replace_result $d245 d245 $d255 d255
|
|
eval CREATE TABLE `$d255`.`$d245` (x INT) ENGINE=InnoDB;
|
|
--replace_result $d250 d250 $d255 d255
|
|
eval DROP TABLE `$d255`.`$d250`;
|
|
|
|
--replace_result $d245 d245 $d250 d250 d255 d255
|
|
eval RENAME TABLE `$d255`.`$d245` TO `$d255`.`$d250`;
|
|
--replace_result $d250 d250 $d255 d255
|
|
eval RENAME TABLE `$d255`.`$d250` TO a;
|
|
--replace_result $d255 d255
|
|
DROP TABLE a,t;
|
|
|
|
--echo #
|
|
--echo # MDEV-29409 Buffer overflow in my_wc_mb_filename() on RENAME TABLE
|
|
--echo #
|
|
|
|
let $d225=#############################################;
|
|
let $d320=################################################################;
|
|
|
|
--replace_result $d255 d255
|
|
eval CREATE TABLE `$d255`.t(a INT PRIMARY KEY)ENGINE=InnoDB;
|
|
--replace_result $d255 d255 $d320 d320
|
|
eval CREATE TABLE `$d255`.u(a INT PRIMARY KEY,
|
|
CONSTRAINT `$d320` FOREIGN KEY (a) REFERENCES `$d255`.t (a)) ENGINE=InnoDB;
|
|
--replace_result $d255 d255
|
|
eval RENAME TABLE `$d255`.u TO u;
|
|
DROP TABLE u;
|
|
--replace_result $d255 d255
|
|
eval DROP DATABASE `$d255`;
|
|
|
|
--echo # End of 10.3 tests
|