Should a primary key be immutable?
Posted
by
Vincent Malgrat
on Programmers
See other posts from Programmers
or by Vincent Malgrat
Published on 2010-09-29T11:19:47Z
Indexed on
2011/11/17
10:11 UTC
Read the original article
Hit count: 269
A recent question on stackoverflow provoked a discussion about the immutability of primary keys. I had thought that it was a kind of rule that primary keys should be immutable. If there is a chance that some day a primary key would be updated, I thought you should use a surrogate key. However it is not in the SQL standard and some RDBMS' "cascade update" feature allows a primary key to change.
So my question is: is it still a bad practice to have a primary key that may change ? What are the cons, if any, of having a mutable primary key ?
© Programmers or respective owner