Re: How to use read uncommitted transaction level and set update order - Mailing list pgsql-general

From Tom Lane
Subject Re: How to use read uncommitted transaction level and set update order
Date
Msg-id 16207.1261260123@sss.pgh.pa.us
Whole thread Raw
In response to Re: How to use read uncommitted transaction level and set update order  (Christophe Pettus <xof@thebuild.com>)
Responses Re: How to use read uncommitted transaction level and set update order
List pgsql-general
Christophe Pettus <xof@thebuild.com> writes:
> On Dec 19, 2009, at 11:24 AM, Andrus wrote:
>> update test1 set a=4, b=a ;

>> How to use updated value ?

> The problem here isn't the transaction isolation level.  The order of
> evaluation in an UPDATE statement is (for practical purposes):
> Evaluate all of the right-hand side expressions, and then assign them
> all to the left-hand side fields.

This is required by the SQL standard, and always has been --- I quote SQL92:

         6) The <value expression>s are effectively evaluated before updat-
            ing the object row. If a <value expression> contains a reference
            to a column of T, then the reference is to the value of that
            column in the object row before any value of the object row is
            updated.

I would be quite surprised if there are any SQL databases that do this
differently.

            regards, tom lane

pgsql-general by date:

Previous
From: Christophe Pettus
Date:
Subject: Re: How to use read uncommitted transaction level and set update order
Next
From: Pavel Stehule
Date:
Subject: Re: How to call a function that returns a refcursor ?