Hallöchen!

Dan writes:

> Django sets this for you if your database supports it (ie: you are
> using postgres or mysql with innodb tables). If you are using
> mysql, check that tables aren't MyISAM.

Okay, I have InnoDB.

> If you want to do this inside Django, more complex because if you
> change an object's primary key, Django concludes that you want to
> work with another row altogether and doesn't modify your original
> row.

So what happens when I say

my_db_object.its_primary_key = new_value
my_db_object.save()

?  Is a new object created or the row changed?  If the first, how do
I change the value at all?

> Can I ask why you would need to change PKs?

Yes.  We are a scientific institution, and I create a samples
database.  Frequently a sample gets a new name, however, the old
name(s) must be kept as aliases.

For the aliases, I probably will use a second table with many-to-one
relationship.

I wanted to keep the (current) sample name the primary key because I
think that this accelerates lookup, but if all else fails, I must
use a surrogate key.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                   Jabber ID: [EMAIL PROTECTED]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to