| 1 |
--echo # |
| 2 |
--echo # Test the limits of a file-per-table tablespace name. MySQL combines |
| 3 |
--echo # the database name with the table name to make a unique table name. |
| 4 |
--echo # |
| 5 |
|
| 6 |
# There is no use in testing the maximum expanded filename using "#" or |
| 7 |
# some other character that is expanded by MySQL to "@0023" because |
| 8 |
# Windows imposes a maximum absolute path length of 260 bytes. So the |
| 9 |
# results will depend upon what local directory this test is run in. |
| 10 |
# See https://msdn.microsoft.com/en-us/library/aa365247.aspx |
| 11 |
# "Maximum Path Length Limitation |
| 12 |
# In the Windows API, the maximum length for a path is MAX_PATH, which is |
| 13 |
# defined as 260 characters. A local path is structured in the following |
| 14 |
# order: drive letter, colon, backslash, name components separated by |
| 15 |
# backslashes, and a terminating null character. For example, the maximum |
| 16 |
# path on drive D is "D:\some 256-character path string<NUL>" where |
| 17 |
# "<NUL>" represents the invisible terminating null character for the |
| 18 |
# current system codepage. (The characters < > are used here for visual |
| 19 |
# clarity and cannot be part of a valid path string.)" |
| 20 |
|
| 21 |
--source include/windows.inc |
| 22 |
# This will test the limit of a filename in MySQL at 512 bytes. |
| 23 |
# We control that by making it a relative path starting with "./". |
| 24 |
|
| 25 |
SET default_storage_engine=InnoDB; |
| 26 |
LET $MYSQLD_DATADIR = `select @@datadir`; |
| 27 |
|
| 28 |
--echo # |
| 29 |
--echo # MySQL limits each database and tablename identifier to 64 characters |
| 30 |
--echo # of up to 3 bytes per character, corresponding to 192 bytes. |
| 31 |
--echo # |
| 32 |
LET $too_long_name = this_sixty_five_byte_name_is_too_long____________________________; |
| 33 |
--error ER_TOO_LONG_IDENT |
| 34 |
--eval CREATE DATABASE `$too_long_name` |
| 35 |
|
| 36 |
LET $long_name = this_sixty_four_byte_name_is_not_too_long_______________________; |
| 37 |
--eval CREATE DATABASE `$long_name` |
| 38 |
--eval USE `$long_name` |
| 39 |
|
| 40 |
--echo # |
| 41 |
--echo # A 64 character tablename can be created in a 64 character database name |
| 42 |
--echo # |
| 43 |
--eval CREATE TABLE `$long_name`.`$long_name` (a SERIAL) |
| 44 |
|
| 45 |
--echo # |
| 46 |
--echo # A 65 character tablename is too long. |
| 47 |
--echo # |
| 48 |
--error ER_TOO_LONG_IDENT |
| 49 |
--eval CREATE TABLE `test`.`$too_long_name` (a SERIAL) |
| 50 |
--error ER_TOO_LONG_IDENT |
| 51 |
--eval CREATE TABLE `$long_name`.`$too_long_name` (a SERIAL) |
| 52 |
|
| 53 |
--echo # |
| 54 |
--echo # Show the successfully created database and table |
| 55 |
--echo # |
| 56 |
--eval SHOW CREATE TABLE `$long_name`.`$long_name` |
| 57 |
|
| 58 |
--echo ---- list_files MYSQLD_DATADIR/$long_name |
| 59 |
--list_files $MYSQLD_DATADIR/$long_name |
| 60 |
|
| 61 |
SELECT name FROM information_schema.innodb_tables WHERE name LIKE '%long%'; |
| 62 |
SELECT name FROM information_schema.innodb_tablespaces WHERE name LIKE '%long%'; |
| 63 |
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR |
| 64 |
SELECT path FROM information_schema.innodb_datafiles WHERE path LIKE '%long%'; |
| 65 |
--vertical_results |
| 66 |
--replace_regex /innodb_file_per_table.[0-9]*/innodb_file_per_table.##/ |
| 67 |
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR |
| 68 |
SELECT file_name, tablespace_name FROM information_schema.files WHERE file_name LIKE '%long%'; |
| 69 |
--horizontal_results |
| 70 |
|
| 71 |
--echo # |
| 72 |
--echo # A 64 character tablename can cause a partitioned table |
| 73 |
--echo # to have a path that is too long. |
| 74 |
--echo # |
| 75 |
|
| 76 |
--error ER_TABLE_NAME_CAUSES_TOO_LONG_PATH |
| 77 |
CREATE TABLE TH6EDXFX5D1U5BLB3I50LN5DFO415JIRP9XKUC0H9O2IONKQL3IOMFYW4ZVOCFPP (a INT NOT NULL, b INT) |
| 78 |
PARTITION BY RANGE (a) PARTITIONS 3 SUBPARTITION BY KEY (b) |
| 79 |
(PARTITION O8W7066AGXADOMYWHT89TWMBJOMTFDMDC74WJ7IUPKD75LVU1ENOV1J008SJBKKF VALUES LESS THAN (200) |
| 80 |
(SUBPARTITION YWKQ987ZTKDJ33ZBMLW526153X86VXL4X44R15SPF8JQS92665MT0QI6BSNKAZY5, |
| 81 |
SUBPARTITION OSYA45V7KKPJ840E4CZ7CKFXDT3J1NNM8QTT9BQOF896CAZVWFY4K236VHYD1WXN, |
| 82 |
SUBPARTITION M6YGLCVSKPSVF1RYZA4XJNP7HP9P7OKBP0268T2HKJ0005BW3LLSALQJ94UE5ZSV), |
| 83 |
PARTITION F3HRUC798U6YIBQFSC9BDKOAUH2SD6B0A3IA7J4P2V8M5U84AAVCR27NNQGM8NI3 VALUES LESS THAN (600) |
| 84 |
(SUBPARTITION YKWIEPEMRMG097FJ0D8WBJC9TF93GW7GVSU8H0MXYSX940JYO0RNVR4W7YYEZDSF, |
| 85 |
SUBPARTITION WDJZ36D1IMDRB4ZABLZXWE7J00OP1WR028V1PREZN46PK9L3Y3ERVTWKXYTMC08W, |
| 86 |
SUBPARTITION KRR0PI4ZBU50X4YVWKDA65PFYRNB69EV5LMM3CMBUVUEIHN2MPY30O8J8WEOOG2Q), |
| 87 |
PARTITION UYZ1675BEXI942ED7EUYLK03GM90QG3ZGYBLBKGLNWVYNVYUZ70J78BJWYLGS6CV VALUES LESS THAN (1800) |
| 88 |
(SUBPARTITION XIYZDGAOHPZH1R6RTKURMSUENS8VIN1U1CL7T2594FWR1ELS55UDVDWVX65K3WPE, |
| 89 |
SUBPARTITION J64S0S338J2AV273XIHW1QHFRK9ZVLSIGSXFF4E22RYCLAG2J3H04PN6M70OB39Y, |
| 90 |
SUBPARTITION XRL60IN1WNLR4YQAIILJTB9XCDP7Z4CUXRCY9Y2ES55W6UQERG51QV1UYTMZW673)); |
| 91 |
|
| 92 |
--echo # |
| 93 |
--echo # Cleanup |
| 94 |
--echo # |
| 95 |
|
| 96 |
USE test; |
| 97 |
--eval DROP DATABASE `$long_name` |
| 98 |
|
| 99 |
--disable_query_log |
| 100 |
call mtr.add_suppression("\\[ERROR\\] .* Operating system error number 3 in a file operation"); |
| 101 |
call mtr.add_suppression("\\[ERROR\\] .* The error means the system cannot find the path specified. It might be too long or it might not exist"); |
| 102 |
call mtr.add_suppression("\\[ERROR\\] .* Cannot create file '.*ibd'"); |
| 103 |
call mtr.add_suppression("\\[ERROR\\] .* Cannot create tablespace '.*ibd'. The filepath is too long for this OS"); |
| 104 |
--enable_query_log |