processwire / processwire-issues

ProcessWire issue reports.
45 stars 2 forks source link

Prevent long field names that clash with MySQL maximum length of table names? #1966

Open jlahijani opened 2 months ago

jlahijani commented 2 months ago

MySQL has a limit of 64 characters for table names.

Not sure if this is necessarily a bug, but something I experienced that I think ProcessWire should handle.

If I make a new field with this name it's valid:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

But if rename that field and add one more x, like this:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

... then I get the following error when saving the field because it's over 64 characters:

ProcessField: SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name 'tmp_field_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'