Re: Theoretical Basis for SELECT FOR UPDATE

From: vc <boston103_at_hotmail.com>
Date: 4 Oct 2005 13:13:06 -0700
Message-ID: <1128456786.735903.204550_at_g47g2000cwa.googlegroups.com>


Tony Andrews wrote:
> vc wrote:
> > Assuming t1 contains one row, consider this:
> >
> > update t1 set x=2, update t1 set x=3;
> >
> > Wha(and why) will the result be, two or three, or unpredictable ?
>
> If it were allowed, it would be unpredictable. But it should not be
> allowed, because it attempts to do two contradictory things at once.

How is the database to decide what's contradictory and what's not ?

Anyway, a more realistic example ;):

raise salary and fire everybody whose salary is more than 10000:

update t1 set salary=salary+1000, delete from t1 where salary >10000;

What would be the effect of such statement ? Is it unpredictable or not ? Why ?

>
> What should happen in SQL if you do this (equivalent) statement?:
>
> update t1 set x=2, x=3;

An error message would appear saying "a duplicate column detected" or something like that. Received on Tue Oct 04 2005 - 22:13:06 CEST

Original text of this message