id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux
11658,mysql backend doesn't define a max_name_length(),abeld@…,nobody,"MySql has a limit on the length of table, constaint, etc. names
(http://dev.mysql.com/doc/refman/4.1/en/identifiers.html), however, a
max_name_length() is not defined in django/db/backends/mysql/base.py
This means that long model names can trigger #1820 (In my case, a name
of a constraint was too long, ending up triggering this bug, even
though comment no. 6 on that ticket (http://code.djangoproject.com/ticket/1820#comment:6)
claims that is solved for constaints.)
Another comment might be comment no. 7 on #10358
(http://code.djangoproject.com/ticket/10358#comment:7) which mentions
a lack of max_name_length() but somehow doesn't consider this a
problem.
In my case, adding the following:
{{{
def max_name_length(self):
return 64
}}}
to DatabaseOperations in django/db/backends/mysql/base.py appears to
solve the
_mysql_exceptions.OperationalError: (1059, ""Identifier name 'somelongmodelname_id_refs_question_ptr_id_8c9b12fefd7d140' is too long"")
problem
",,closed,"Database layer (models, ORM)",master,,fixed,,,Accepted,0,0,0,0,,