pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marko Tiikkaja <marko@joh.to>
To: 德哥 <digoal@126.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #13465: multi update query use CTE, result & plan not equal, BUG?
Date: Thu, 25 Jun 2015 15:05:47 +0200
Message-ID: <558BFCAB.6050505@joh.to> (raw)
In-Reply-To: <28badccd.127a.14e281d1501.Coremail.digoal@126.com>
References: <20150624055850.3873.90673@wrigleys.postgresql.org>
	<CAKFQuwbWg1pT0dik8EX_QjWR+vxrxtDws9axmJuOi+==y3cnew@mail.gmail.com>
	<28badccd.127a.14e281d1501.Coremail.digoal@126.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (5+ messages)

Message-ID: <558BFCAB.6050505@joh.to>
Permalink:  ../558BFCAB.6050505@joh.to/
Also on:    postgresql.org/message-id/558BFCAB.6050505@joh.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: marko@joh.to, digoal@126.com, david.g.johnston@gmail.com
  Subject: Re: BUG #13465: multi update query use CTE, result & plan not equal, BUG?
  In-Reply-To: <558BFCAB.6050505@joh.to>
  References: <20150624055850.3873.90673@wrigleys.postgresql.org> <CAKFQuwbWg1pT0dik8EX_QjWR+vxrxtDws9axmJuOi+==y3cnew@mail.gmail.com> <28badccd.127a.14e281d1501.Coremail.digoal@126.com> <558BFCAB.6050505@joh.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox