Fix identifier names exceeding 64 characters#9
Open
fkmy wants to merge 1 commit intosyucream:masterfrom
Open
Conversation
Since MySQL 8.0, the following error occurred when the table name is long. ERROR 1059 (42000) at line 115: Identifier name 'too_long_table_name_ibfk_1' is too long Ref: https://dev.mysql.com/doc/refman/8.0/en/identifier-length.html
fkmy
commented
Nov 12, 2024
| // If the table name is too long, the foreign key name will also be too long, | ||
| // and an error will occur if the foreign key name exceeds 64 characters. | ||
| // I think 4 digits is enough for numbering. | ||
| if len(c.Table) >= 56 { |
Author
There was a problem hiding this comment.
64 characters - ( "_ibfk_"(6 characters) + number(1 or more characters) )
= 57 characters
Table name is allowed up to 57 characters, but considering the case where number is 2-digit, set it to 56 characters.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for this useful tool!
Since MySQL 8.0, the following error occurred when the table name is long.
ERROR 1059 (42000) at line 115: Identifier name 'too_long_table_name_ibfk_1' is too longRef: https://dev.mysql.com/doc/refman/8.0/en/identifier-length.html
To avoid this error, if the table name is long, the response is to specify the FK name.