Re: BUG #13465: multi update query use CTE, result & plan not equal, BUG? - Mailing list pgsql-bugs

From Marko Tiikkaja
Subject Re: BUG #13465: multi update query use CTE, result & plan not equal, BUG?
Date
Msg-id 558BFCAB.6050505@joh.to
Whole thread Raw
In response to Re: BUG #13465: multi update query use CTE, result & plan not equal, BUG?  (德哥 <digoal@126.com>)
List 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

pgsql-bugs by date:

Previous
From: hunkaverage@gmail.com
Date:
Subject: BUG #13468: System hijacked by PostgreSQL user
Next
From: Tom Lane
Date:
Subject: Re: Bug in docs - modifiers for to_char()