| 1 |
# |
| 2 |
# Test the limits of a file-per-table tablespace name. MySQL combines |
| 3 |
# the database name with the table name to make a unique table name. |
| 4 |
# |
| 5 |
SET default_storage_engine=InnoDB; |
| 6 |
# |
| 7 |
# MySQL limits each database and tablename identifier to 64 characters |
| 8 |
# of up to 3 bytes per character, corresponding to 192 bytes. |
| 9 |
# |
| 10 |
CREATE DATABASE `this_sixty_five_byte_name_is_too_long____________________________`; |
| 11 |
ERROR 42000: Identifier name 'this_sixty_five_byte_name_is_too_long____________________________' is too long |
| 12 |
CREATE DATABASE `this_sixty_four_byte_name_is_not_too_long_______________________`; |
| 13 |
USE `this_sixty_four_byte_name_is_not_too_long_______________________`; |
| 14 |
# |
| 15 |
# A 64 character tablename can be created in a 64 character database name |
| 16 |
# |
| 17 |
CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_four_byte_name_is_not_too_long_______________________` (a SERIAL); |
| 18 |
# |
| 19 |
# A 65 character tablename is too long. |
| 20 |
# |
| 21 |
CREATE TABLE `test`.`this_sixty_five_byte_name_is_too_long____________________________` (a SERIAL); |
| 22 |
ERROR 42000: Identifier name 'this_sixty_five_byte_name_is_too_long____________________________' is too long |
| 23 |
CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_five_byte_name_is_too_long____________________________` (a SERIAL); |
| 24 |
ERROR 42000: Identifier name 'this_sixty_five_byte_name_is_too_long____________________________' is too long |
| 25 |
# |
| 26 |
# Show the successfully created database and table |
| 27 |
# |
| 28 |
SHOW CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_four_byte_name_is_not_too_long_______________________`; |
| 29 |
Table Create Table |
| 30 |
this_sixty_four_byte_name_is_not_too_long_______________________ CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________` ( |
| 31 |
`a` bigint unsigned NOT NULL AUTO_INCREMENT, |
| 32 |
UNIQUE KEY `a` (`a`) |
| 33 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 34 |
---- list_files MYSQLD_DATADIR/this_sixty_four_byte_name_is_not_too_long_______________________ |
| 35 |
this_sixty_four_byte_name_is_not_too_long_______________________.ibd |
| 36 |
SELECT name FROM information_schema.innodb_tables WHERE name LIKE '%long%'; |
| 37 |
name |
| 38 |
this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________ |
| 39 |
SELECT name FROM information_schema.innodb_tablespaces WHERE name LIKE '%long%'; |
| 40 |
name |
| 41 |
this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________ |
| 42 |
SELECT path FROM information_schema.innodb_datafiles WHERE path LIKE '%long%'; |
| 43 |
PATH |
| 44 |
./this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________.ibd |
| 45 |
SELECT file_name, tablespace_name FROM information_schema.files WHERE file_name LIKE '%long%'; |
| 46 |
FILE_NAME ./this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________.ibd |
| 47 |
TABLESPACE_NAME this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________ |
| 48 |
# |
| 49 |
# A 64 character tablename can cause a partitioned table |
| 50 |
# to have a path that is too long. |
| 51 |
# |
| 52 |
CREATE TABLE TH6EDXFX5D1U5BLB3I50LN5DFO415JIRP9XKUC0H9O2IONKQL3IOMFYW4ZVOCFPP (a INT NOT NULL, b INT) |
| 53 |
PARTITION BY RANGE (a) PARTITIONS 3 SUBPARTITION BY KEY (b) |
| 54 |
(PARTITION O8W7066AGXADOMYWHT89TWMBJOMTFDMDC74WJ7IUPKD75LVU1ENOV1J008SJBKKF VALUES LESS THAN (200) |
| 55 |
(SUBPARTITION YWKQ987ZTKDJ33ZBMLW526153X86VXL4X44R15SPF8JQS92665MT0QI6BSNKAZY5, |
| 56 |
SUBPARTITION OSYA45V7KKPJ840E4CZ7CKFXDT3J1NNM8QTT9BQOF896CAZVWFY4K236VHYD1WXN, |
| 57 |
SUBPARTITION M6YGLCVSKPSVF1RYZA4XJNP7HP9P7OKBP0268T2HKJ0005BW3LLSALQJ94UE5ZSV), |
| 58 |
PARTITION F3HRUC798U6YIBQFSC9BDKOAUH2SD6B0A3IA7J4P2V8M5U84AAVCR27NNQGM8NI3 VALUES LESS THAN (600) |
| 59 |
(SUBPARTITION YKWIEPEMRMG097FJ0D8WBJC9TF93GW7GVSU8H0MXYSX940JYO0RNVR4W7YYEZDSF, |
| 60 |
SUBPARTITION WDJZ36D1IMDRB4ZABLZXWE7J00OP1WR028V1PREZN46PK9L3Y3ERVTWKXYTMC08W, |
| 61 |
SUBPARTITION KRR0PI4ZBU50X4YVWKDA65PFYRNB69EV5LMM3CMBUVUEIHN2MPY30O8J8WEOOG2Q), |
| 62 |
PARTITION UYZ1675BEXI942ED7EUYLK03GM90QG3ZGYBLBKGLNWVYNVYUZ70J78BJWYLGS6CV VALUES LESS THAN (1800) |
| 63 |
(SUBPARTITION XIYZDGAOHPZH1R6RTKURMSUENS8VIN1U1CL7T2594FWR1ELS55UDVDWVX65K3WPE, |
| 64 |
SUBPARTITION J64S0S338J2AV273XIHW1QHFRK9ZVLSIGSXFF4E22RYCLAG2J3H04PN6M70OB39Y, |
| 65 |
SUBPARTITION XRL60IN1WNLR4YQAIILJTB9XCDP7Z4CUXRCY9Y2ES55W6UQERG51QV1UYTMZW673)); |
| 66 |
ERROR HY000: Long database name and identifier for object resulted in a path length too long for table 'th6edxfx5d1u5blb3i50ln5dfo415jirp9xkuc0h9o2ionkql3iomfyw4zvocfpp'. Please check the path limit for your OS. |
| 67 |
# |
| 68 |
# Cleanup |
| 69 |
# |
| 70 |
USE test; |
| 71 |
DROP DATABASE `this_sixty_four_byte_name_is_not_too_long_______________________`; |