#8659: Quote relation name creating PostgreSQL database
----------------------------+-----------------------------------------------
 Reporter:  Hystrix         |       Owner:  nobody    
   Status:  new             |   Milestone:            
Component:  Core framework  |     Version:  SVN       
 Keywords:                  |       Stage:  Unreviewed
Has_patch:  0               |  
----------------------------+-----------------------------------------------
 Using PostgreSQL as a database backend, if I define a model with a
 foreignkey field with an uppercase letter in the attribute name, the
 relation constrait name would end with all the letters in lowercase. This
 can have various side effects such as not being able to reset the database
 becuase Django can't remove the constrait (it tries to remove a constrait
 with uppercase letters and the one in the database is all lowercase).
 This happens because the constraint name is not quoted when the database
 is created.
 All it takes to fix this is add backend.quote_name to the name while
 creating the sql.
 I fixed it in 0.96 but I can't find where this should be changed in SVN.

 Bad SQL:
 {{{ALTER TABLE "proto0_viaje" ADD CONSTRAINT
 reservadoPor_id_refs_id_331c0818 FOREIGN KEY ("reservadoPor_id")
 REFERENCES "proto0_empleado" ("id") DEFERRABLE INITIALLY DEFERRED;}}}

 Good SQL:
 {{{ALTER TABLE "proto0_viaje" ADD CONSTRAINT
 "reservadoPor_id_refs_id_331c0818" FOREIGN KEY ("reservadoPor_id")
 REFERENCES "proto0_empleado" ("id") DEFERRABLE INITIALLY DEFERRED;}}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/8659>
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