WITH x AS (...) and visibility in UPDATE

Поиск
Список
Период
Сортировка
От Peter V
Тема WITH x AS (...) and visibility in UPDATE
Дата
Msg-id BAY149-W55A7FB9E6B52EF32783636C1350@phx.gbl
обсуждение исходный текст
Ответы Re: WITH x AS (...) and visibility in UPDATE  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
Hello all,

I am trying out PostgreSQL 9.1 Beta 3. In particular, I am very interested in WITH x AS (...) construction.

drop table if exists t;
create table t
(
    identifier   serial,
    title        text
);

with c as
(
    insert into t (title) values ('old') returning *
)
update t set title = 'new' from c where t.identifier = c.identifier;

select * from t;

Can someone explain why this returns 'old' instead of 'new'? Is the new row not yet visible when the update is
evaluated?

Thanks.


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

Предыдущее
От: John Cheng
Дата:
Сообщение: Re: Cannot reproduce why a query is slow
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: WITH x AS (...) and visibility in UPDATE