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

Поиск
Список
Период
Сортировка
От Christophe Pettus
Тема Re: How to use read uncommitted transaction level and set update order
Дата
Msg-id F0F70752-EE6B-47E3-A4B0-0B65A5B594EE@thebuild.com
обсуждение исходный текст
Ответ на How to use read uncommitted transaction level and set update order  ("Andrus" <kobruleht2@hot.ee>)
Ответы Re: How to use read uncommitted transaction level and set update order  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: How to use read uncommitted transaction level and set update order  ("Andrus" <kobruleht2@hot.ee>)
Список pgsql-general
On Dec 19, 2009, at 11:24 AM, Andrus wrote:
> set transaction isolation level read uncommitted;
> create temp table test1 ( a int, b int) on commit drop;
> insert into test1 values(1,2);
> update test1 set a=4, b=a ;
> select * from test1
>
> b value is 1 but must be 4.
> 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.

It's not clear why you need to do it this way, though.  Presumably,
since you did some kind of computation that came up with the number
'4', you can assign that value instead of using the field a:

UPDATE test1 set a=4, b=4;

--
-- Christophe Pettus
    xof@thebuild.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Jaime Casanova
Дата:
Сообщение: Re: How to use read uncommitted transaction level and set update order
Следующее
От: Tom Lane
Дата:
Сообщение: Re: How to use read uncommitted transaction level and set update order