Re: BUG #13465: multi update query use CTE, result & plan not equal, BUG?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: digoal(at)126(dot)com
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13465: multi update query use CTE, result & plan not equal, BUG?
Date: 2015-06-24 14:45:29
Message-ID: CAKFQuwbWg1pT0dik8EX_QjWR+vxrxtDws9axmJuOi+==y3cnew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Jun 24, 2015 at 1:58 AM, <digoal(at)126(dot)com> wrote:

> The following bug has been logged on the website:
>

​Not a bug...​

PostgreSQL 9.5
> when i use CTE update t1 two times, on problem : there is diffient results.
> another problem : CTE update one table two times, which query exec first,
> and how to isolation MVCC? why these result not same?
>

​The update of t1 outside of the CTE cannot see any of the changes made
within the CTE - which is why a RETURNING clause is required to pass
changes.

The non-CTE action effectively takes precedence​.

t1(1,'abc')

WITH up AS (
UPDATE t1 SET t1.info = 'xyz';
)
SELECT info FROM t1; -- returns abc, not xyz

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Merlin Moncure 2015-06-24 15:43:22 getting "ERROR: tuple concurrently updated" during concurrent grant/revoke operations (9.2.13)
Previous Message Tom Lane 2015-06-24 14:36:56 Re: BUG #13467: Latest Openssl library forces Postgres to Close Connections