Re: Theoretical Basis for SELECT FOR UPDATE

From: vc <boston103_at_hotmail.com>
Date: 4 Oct 2005 12:23:44 -0700
Message-ID: <1128453823.972796.281600_at_z14g2000cwz.googlegroups.com>


Tony Andrews wrote:
> vc wrote:
> > Tony Andrews wrote:
> > > No. There is no "sequence" here - that is the whole point!
> >
> > So, assuming t1 has no rows,
> >
> > insert into t1(x) values(1),update t1 where x=1 set x=2;
> >
> > would have the same result as
> >
> > update t1 where x=1 set x=2, insert into t1(x) values(1);
> >
> > Is that what you are saying ?
>
> Yes. And the result would be to insert a row into t1 with x = 1. The
> update would do nothing, because there was no row with x = 1 to update
> prior to this statement's execution.

OK, let's assume for the argument sake that you are right and the substatements are executed in no particular order, or even in parallel, (although the result of such execution will be different with different concurrency control mechanisms).

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 ? Received on Tue Oct 04 2005 - 21:23:44 CEST

Original text of this message