On Wed, Jun 03, 2009 at 03:47:18PM -0500, Jaime Casanova wrote:
> > Django does not currently support multiple column primary keys, see:
> > http://code.djangoproject.com/ticket/373

At the very least django should complain loudly when you try this. I didn't
realize my database (from a legacy schema) had any problems until I tried
updating one of these table entries, and found it updated a group of entries -
ie. django only took notice of one primary key and ignored the other primary
key without any notice.

> good database design makes use very often of composite pk's so my best
> bet is to declare the models without a primary key and make my code
> decide if an UPDATE or an INSERT is needed?

Having composite pks can have a gotcha. For example, in my mysql based
database, my legacy application had the primary key (from memory) in a table of
(photo_id,album_id) - this was a table linking photos and albums together. 
However
the order of the primary key is important. So if I wanted to find a list of
photo_ids for a particular album_id (without any additional indexes), mysql 
would
have to search the entire database because the photo id comes first in the 
index,
meaning it can't be used.
-- 
Brian May <br...@microcomaustralia.com.au>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to