summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/foreign_key_not_windows.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/innodb/t/foreign_key_not_windows.test')
-rw-r--r--mysql-test/suite/innodb/t/foreign_key_not_windows.test45
1 files changed, 45 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/t/foreign_key_not_windows.test b/mysql-test/suite/innodb/t/foreign_key_not_windows.test
new file mode 100644
index 00000000000..7ad3723d5de
--- /dev/null
+++ b/mysql-test/suite/innodb/t/foreign_key_not_windows.test
@@ -0,0 +1,45 @@
+--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;
+--replace_result $d255 d255
+eval DROP DATABASE `$d255`;
+DROP TABLE t;
+
+--echo # End of 10.3 tests