#5671: Change SQL generation when primary_key=True and unique=True
----------------------------------------------+-----------------------------
Reporter:  Nis Jørgensen <[EMAIL PROTECTED]>  |       Owner:  nobody          
  Status:  new                                |   Component:  Database wrapper
 Version:  SVN                                |    Keywords:                  
   Stage:  Unreviewed                         |   Has_patch:  0               
----------------------------------------------+-----------------------------
 At the moment, these two models, which are logically equivalent, generate
 different sql:

 {{{

 class Country(models.Model):
     isocode = CharField(max_length=3, primary_key=True, unique=True)
 }}}

 {{{


 class Country(models.Model):
     isocode = CharField(max_length=3, primary_key=True)
 }}}

 - at least for backends other than Oracle

 I would like to suggest that we do not create explicit UNIQUE constraints
 for (single field) primary keys.

 On the other hand, I think it would be nice if field.unique returned True
 for a primary key field no matter if it was defined as such or not.

 I will write a patch doing this, but am of course open to alternative
 suggestions.

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