Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z86qu-000147-UE for pgsql-bugs@arkaria.postgresql.org; Thu, 25 Jun 2015 13:06:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Z86qu-0007hq-5i for pgsql-bugs@arkaria.postgresql.org; Thu, 25 Jun 2015 13:06:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z86qt-0007hd-4Q for pgsql-bugs@postgresql.org; Thu, 25 Jun 2015 13:05:59 +0000 Received: from mail-lb0-f173.google.com ([209.85.217.173]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Z86ql-0000yc-Ko for pgsql-bugs@postgresql.org; Thu, 25 Jun 2015 13:05:58 +0000 Received: by lbbpo10 with SMTP id po10so45091046lbb.3 for ; Thu, 25 Jun 2015 06:05:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=5LY71UD8tPzzQ//ULx4KN8+wCdRsSREqTMO/XnhY9oU=; b=MOWCLW+6FstJKCeWSIgkFHRSJeNCkEayXqqs/IVlpO4dHLBq0DJVPtoYlqWIcVnz78 aBI4Aojw1uSWuK/DMwdZ1sCbb6Z7YCWv14n0T9yq8JJj6hMkHChP0Mdqk1mzIvnvdnQ5 5/9gbAulc7FmSdqTgMQhLwQFt7QYIWCSwd0VcpduMrto12qsG8xg+7UwIKpGhV7sBEsi A/MBwnvy5+gmTE0S/6Rrsf0jZOUsczcDjoghA5aOrJBKZRz7m5+/qXzMN3gnx8e8VwpX XzC6OsYIr3p1hNJmDeXySaI7m3bEQNhuv3fbvLbNMnSWP4O9oTCe0ZNhFD7ettBz6Qg2 BWpQ== X-Gm-Message-State: ALoCoQm5YfrowIHeTDn5uVmBN7djkIoZKzgXi0bE9xxV6bgVjUkKmgPAbOp2IjxoEIvr5lYTjotD X-Received: by 10.152.1.40 with SMTP id 8mr45715879laj.56.1435237549921; Thu, 25 Jun 2015 06:05:49 -0700 (PDT) Received: from Markos-MacBook-Pro.local ([46.246.117.202]) by mx.google.com with ESMTPSA id ci2sm2265486lad.48.2015.06.25.06.05.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jun 2015 06:05:49 -0700 (PDT) Message-ID: <558BFCAB.6050505@joh.to> Date: Thu, 25 Jun 2015 15:05:47 +0200 From: Marko Tiikkaja User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: =?gbk?Q?=B5=C2=B8=E7?= , "David G. Johnston" CC: "pgsql-bugs@postgresql.org" Subject: Re: BUG #13465: multi update query use CTE, result & plan not equal, BUG? References: <20150624055850.3873.90673@wrigleys.postgresql.org> <28badccd.127a.14e281d1501.Coremail.digoal@126.com> In-Reply-To: <28badccd.127a.14e281d1501.Coremail.digoal@126.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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