WITH x AS (...) and visibility in UPDATE - Mailing list pgsql-general

From Peter V
Subject WITH x AS (...) and visibility in UPDATE
Date
Msg-id BAY149-W55A7FB9E6B52EF32783636C1350@phx.gbl
Whole thread Raw
Responses Re: WITH x AS (...) and visibility in UPDATE  (Merlin Moncure <mmoncure@gmail.com>)
List 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 by date:

Previous
From: John Cheng
Date:
Subject: Re: Cannot reproduce why a query is slow
Next
From: Merlin Moncure
Date:
Subject: Re: WITH x AS (...) and visibility in UPDATE