Re: Surrogate Keys: an Implementation Issue
Date: Thu, 27 Jul 2006 13:20:10 GMT
Message-ID: <e43yg.27359$pu3.361813_at_ursa-nb00s0.nbnet.nb.ca>
JOG wrote:
>>[big snip] >> >> >>>What does that have to do with the >>>fact that Bob just updated the wrong row? >> >>The wrong row? What was wrong about it? The database was >>told, for example, "Make Suzie's record look like this." >> >>The confusion arising because "Suzie is George and William >>is Suzie but Bob thought George was still Suzie" isn't >>going away just because you slap another value on all your >>records; you're just moving the confusion around.
>
> There is miscommunication in this thread. Brian is coming from an
> assumption that primary keys are mutable, and everyone else from the RM
> specification that they should be immutable.
I disagree. While stability is an important design criterion for candidate keys, it is important due to the difficulty arising when trying to update a referenced key. This has nothing to do with Selzer's idiocy.
Assuming, as Selzer does, that assertions about whatever is identified by ID0 already exist in the database, there are two primary ways that Bob could make the new assertion. He could enter a new value for some attribute to replace some existing value, or he could change some value relative to its current value and/or to other values recorded in the database. If Bob makes multiple assertions regarding different attributes, we can look at each in isolation with the two options above. We can ignore the situation where Bob expresses his assertion relative to what is in the database because the actual value recorded will reflect any intervening updates. We only need to consider situations where Bob replaces some value.
The primary key identifies
> a tuple, and if something's identity changes... well, conceptually, it
> is a completely different thing. Hence in the example you supply Brian,
> the RM is responding perfectly and as we would want it to.
>
> It is the database designer and his choice of primary key that is
> causing the problems. A person's name is an absolutely dire choice as a
> key given they are _not unique_ and _subject to change_. That's exactly
> why you guys have SSN's and I have an UK National Insurance ID. But
> then to me an SSN isn't a surrogate anyhow, it's a unique attribute.
All keys are surrogates. Natural keys are simply familiar surrogates. Received on Thu Jul 27 2006 - 15:20:10 CEST