Re: Surrogate Keys: an Implementation Issue

From: JOG <jog_at_cs.nott.ac.uk>
Date: 27 Jul 2006 05:03:51 -0700
Message-ID: <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 - 14:03:51 CEST

Original text of this message