Description

If you have a ManyToManyField in your model, and it is comprised of long model and app names, you will find that when you use manage.py sqlall appname it will truncate at 64 characters, rather than 32 with a hash as described here

Actually, the note added to the docs is incorrect, as it was the content it replaced.

Django doesn't set a hard limit of 64 nor 32 characters on the names of the auto-generated m2m intermediary tables, is simply uses the max identifier length (provided by a DatabaseOperations.max_name_length() method) reported by the backend, if any.

The Django MySQL DB backend doesn't define max_name_length() and because of that the ORM machinery doesn't truncate the m2m table name at all. I suspect what the OP was seeing is MySQL showing its 64 chars limitation (a comment in the Django source seems to indicate that MySQL doesn't have a hard limit on the length of identifiers, but rather it only considers the first 64 chars to discern among them, I couldn't confirm this).

In contrast, in the Oracle case the RDBMS identifier hard limit is 30, this is correctly reported by the Django DB backend and so an identifier of length > 30 will get converted to a 30 char identifier composed of the original 26 first chars plus 4 chars of and MD5 hash.

Because of the above, IMHO the current note lacks generality and is a bit misleading even in the case of MySQL.