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

From: Marko Tiikkaja <marko(at)joh(dot)to>
To: 德哥 <digoal(at)126(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(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-25 13:05:47
Message-ID: 558BFCAB.6050505@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 6/25/15 2:27 AM, 德哥 wrote:
> But Why, The same SQL has two diff result?
> It's not a BUG?

This test case is still really difficult to follow, but I believe what
you're seeing is documented here:
http://www.postgresql.org/docs/current/static/queries-with.html

"Trying to update the same row twice in a single statement is not
supported. Only one of the modifications takes place, but it is not easy
(and sometimes not possible) to reliably predict which one. This also
applies to deleting a row that was already updated in the same
statement: only the update is performed. Therefore you should generally
avoid trying to modify a single row twice in a single statement. In
particular avoid writing WITH sub-statements that could affect the same
rows changed by the main statement or a sibling sub-statement. The
effects of such a statement will not be predictable."

.m

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2015-06-25 14:36:35 Re: Bug in docs - modifiers for to_char()
Previous Message hubert depesz lubaczewski 2015-06-25 12:15:56 Bug in docs - modifiers for to_char()