#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:  Accepted        
  Has_patch:  1                   |           Needs_docs:  0               
Needs_tests:  0                   |   Needs_better_patch:  1               
----------------------------------+-----------------------------------------
Changes (by Michael Radziej <[EMAIL PROTECTED]>):

  * needs_better_patch:  0 => 1
  * stage:  Ready for checkin => Accepted

Comment:

 Ouch, the patch doesn't work with postgresql. I used 8.1.4:
 
 {{{
 [EMAIL PROTECTED]:testproj$ python manage.py syncdb
 Creating table auth_message
 Creating table auth_group
 Creating table auth_user
 Creating table auth_permission
 Traceback (most recent call last):
   File "manage.py", line 11, in ?
     execute_manager(settings)
   File "/home/mir/lib/python/django/core/management.py", line 1462, in
 execute_manager
     execute_from_command_line(action_mapping, argv)
   File "/home/mir/lib/python/django/core/management.py", line 1370, in
 execute_from_command_line
     action_mapping[action](int(options.verbosity), options.interactive)
   File "/home/mir/lib/python/django/core/management.py", line 511, in
 syncdb
     cursor.execute(statement)
   File "/home/mir/lib/python/django/db/backends/util.py", line 12, in
 execute
     return self.cursor.execute(sql, params)
   File "/home/mir/lib/python/django/db/backends/postgresql/base.py", line
 43, in execute
     return self.cursor.execute(sql, [smart_basestring(p, self.charset) for
 p in params])
 psycopg.ProgrammingError: FEHLER:  Fehler »Syntaxfehler« bei »FOREIGN« at
 character 274
 
 CREATE TABLE "auth_group_permissions" (
     "id" serial NOT NULL PRIMARY KEY,
     "group_id" integer NOT NULL REFERENCES "auth_group" ("id"),
     "permission_id" integer NOT NULL REFERENCES "auth_permission" ("id"),
     UNIQUE ("group_id", "permission_id"),
     CONSTRAINT FOREIGN KEY ("group_id") REFERENCES "auth_group" ("id"),
     CONSTRAINT FOREIGN KEY ("permission_id") REFERENCES "auth_permission"
 ("id")
 );
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2720#comment:10>
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to