Michael Radziej wrote:
> DavidA wrote:
> > I've been having a problem rebuilding my database from scratch via
> > syncdb. I've tracked it down to duplicate constraint name. Here is the
> > output from manage.py sql for my app:
> > ...
> > This used to work, I'm pretty sure, but I haven't rebuilt the whole DB
> > from scratch for a long time so I don't know if its been lingering for
> > a while.
>
> The algorithm for naming the constraints has changed since the
> original way created names that were too long for mysql.
>
> See ticket #2257. There's not a patch, but the idea of the solution.
>
>
> Michael

Thanks. I'll try the suggestion in the ticket.

I also did a little more research on this and found this MySQL bug
report:
http://bugs.mysql.com/bug.php?id=13942

One thing to note is that in MySQL if you don't name the constraint, it
automatically creates one of the form: <table_name>_ibfk_# where # is a
number, ensuring its unique, similar to the suggestion in the ticket.
(But as the MySQL bug report points out, very long table names can
generate constraint names that exceed the 64 character limit).

Since the SQL to generate FK constraints is somewhat non-standard,
wouldn't it make more sense if the generation of the constraint
statement was handled in the backend where you can employ more
DB-specific logic to it? Right now the statements is mostly built up in
django.core.management.syncdb

-Dave


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to