Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Surrogate Keys: an Implementation Issue

Re: Surrogate Keys: an Implementation Issue

From: Brian Selzer <brian_at_selzer-software.com>
Date: Thu, 27 Jul 2006 12:20:41 GMT
Message-ID: <tc2yg.75877$Lm5.74940@newssvr12.news.prodigy.com>


What about compound keys? Compound keys are much more likely to change. What if there is more than one candidate key? If the identity changes when the key value changes, then what if only one candidate key value changes? The fact remains that a natural key, however unlikely, can change. If you build software around the assumption that it won't, you're going to get burned.

"JOG" <jog_at_cs.nott.ac.uk> wrote in message news:1154001831.175738.245960_at_75g2000cwc.googlegroups.com...
>J M Davitt 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. 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.
>
>>
>> Surrogates aren't going to solve the problems stemming
>> from the fact that Bob is working on a stale and partly
>> wrong representation of the data.
>>
>>
>> > How could you prevent that in
>> > application code, or in the middle-tier? You can't, unless you either
>> > (1)
>> > lock the row until Bob gets back from Tahiti, or (2) use a surrogate to
>> > guarantee that the row that's about to be updated is the same as the
>> > one
>> > that was read out.
>>
>> Your list is too short; there are more alternatives. We
>> don't have to wait for Bob and a surrogate isn't going to
>> solve the problem without creating another problem.
>>
>> >
>> >>You are a vociferous ignoramus. It suffices to observe that fact.
>> >>
>> >>[remaining nonsense snipped without further effort]
>> >
>> >
>> >
>
Received on Thu Jul 27 2006 - 07:20:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US