| 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: Incorrect database name 'this_sixty_five_byte_name_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: Incorrect table name 'this_sixty_five_byte_name_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: Incorrect table name 'this_sixty_five_byte_name_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(20) unsigned NOT NULL AUTO_INCREMENT, |
| 32 |
UNIQUE KEY `a` (`a`) |
| 33 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 34 |
---- list_files MYSQLD_DATADIR/this_sixty_four_byte_name_is_not_too_long_______________________ |
| 35 |
db.opt |
| 36 |
this_sixty_four_byte_name_is_not_too_long_______________________.frm |
| 37 |
this_sixty_four_byte_name_is_not_too_long_______________________.ibd |
| 38 |
SELECT name FROM information_schema.innodb_sys_tables WHERE name LIKE '%long%'; |
| 39 |
name |
| 40 |
this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________ |
| 41 |
SELECT name FROM information_schema.innodb_sys_tablespaces WHERE name LIKE '%long%'; |
| 42 |
name |
| 43 |
this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________ |
| 44 |
SELECT file_name, tablespace_name FROM information_schema.files WHERE file_name LIKE '%long%'; |
| 45 |
Warnings: |
| 46 |
Level Warning |
| 47 |
Code 1287 |
| 48 |
Message 'information_schema.FILES' is deprecated and will be removed in a future release |
| 49 |
# |
| 50 |
# Cleanup |
| 51 |
# |
| 52 |
DROP DATABASE `this_sixty_four_byte_name_is_not_too_long_______________________`; |