Re: How to use read uncommitted transaction level and set update order

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christophe Pettus <xof(at)thebuild(dot)com>
Cc: Andrus <kobruleht2(at)hot(dot)ee>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to use read uncommitted transaction level and set update order
Date: 2009-12-19 22:02:03
Message-ID: 16207.1261260123@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Christophe Pettus <xof(at)thebuild(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2009-12-19 22:27:23 Re: How to call a function that returns a refcursor ?
Previous Message Christophe Pettus 2009-12-19 21:53:08 Re: How to use read uncommitted transaction level and set update order