#2720: Wrong syntax generated for foreign keys under MySQL
----------------------------------+-----------------------------------------
Reporter: anonymous | Owner: adrian
Status: new | Component: Database wrapper
Version: | Resolution:
Keywords: innodb foreign key | Stage: Ready for checkin
Has_patch: 1 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
----------------------------------+-----------------------------------------
Changes (by Michael Radziej <[EMAIL PROTECTED]>):
* cc: [EMAIL PROTECTED] (added)
* has_patch: 0 => 1
* summary: Wrong syntax generated for foreign keys under MySQL/InnoDB
5.0.22 => Wrong syntax generated for foreign
keys under MySQL
* stage: Unreviewed => Ready for checkin
Comment:
mysql is strange, and this is a real bug in Django. Only foreign keys to
models defined later escape this bug, because a different syntax is chosen
for these. mysql4 and 5 are affected. The docs in mysql are pretty
explicit that the used syntax is more or less read and thrown away (thank
you, mysql, what a great idea ...)
Here's a model definition:
{{{
from django.db import models
class A(models.Model):
pass
class B(models.Model):
a = models.ForeignKey(A)
}}}
After syncdb, watch this:
{{{
mysql> select * from testapp_a;
Empty set (0.00 sec)
mysql> insert into testapp_b values (1,2);
Query OK, 1 row affected (0.03 sec)
}}}
I checked the patch, and it resolves the problem. Thanks, [EMAIL PROTECTED]
--
Ticket URL: <http://code.djangoproject.com/ticket/2720#comment:9>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---