Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VmxGX-0003iA-3M for pgsql-bugs@arkaria.postgresql.org; Sun, 01 Dec 2013 03:00:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VmxGW-0001FO-ES for pgsql-bugs@arkaria.postgresql.org; Sun, 01 Dec 2013 03:00:12 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VmxGU-0001EL-EM for pgsql-bugs@postgresql.org; Sun, 01 Dec 2013 03:00:10 +0000 Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VmxGM-0007k8-Bq for pgsql-bugs@postgresql.org; Sun, 01 Dec 2013 03:00:09 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1VmxGL-0006u7-M9 for pgsql-bugs@postgresql.org; Sat, 30 Nov 2013 19:00:01 -0800 Date: Sat, 30 Nov 2013 19:00:01 -0800 (PST) From: David Johnston To: pgsql-bugs@postgresql.org Message-ID: <1385866801641-5781041.post@n5.nabble.com> In-Reply-To: <20131130214018.GJ31100@awork2.anarazel.de> References: <25601.1385834264@sss.pgh.pa.us> <20131130214018.GJ31100@awork2.anarazel.de> Subject: Re: Update with subselect sometimes returns wrong result MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 1.8 (+) 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 Andres Freund-3 wrote > deleted row at: (0,1) > deleted row at: (0,5) > new row at: (0,1) > new row at: (0,5) > updated row from (0,1) to (0,3) iter 401 > deleted row at: (0,2) > deleted row at: (0,3) Am I reading this right? Rows == ctid(,#) Rows 1 & 5 exist; are deleted Add two new rows, store them at 1 & 5 replacing the just deleted rows --? does auto-vacuum work that fast that these physical locations are immediately available... Update row 1, store new value in 3 marking 1 as deleted (not shown here) Rows 2? & 3 exist and are now deleted ?Where did Row 2 come from...was expecting row 5...? > new row at: (0,2) > new row at: (0,3) > updated row from (0,1) to (0,3) iter 405 > deleted row at: (0,2) > deleted row at: (0,3) Likewise: how did Row 1 come into being (so that it could be updated) when only 2 and 3 were added on the prior iteration? Then, at the point of the assertion failure, rows 4 & 5 are updated but rows 2 & 3 were the rows that were added...so neither of the just-inserted rows were returned... Sorry I cannot actually debug code but figured my observations might be helpful none-the-less. David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Update-with-subselect-sometimes-returns-wrong-result-tp5780925p5781041.html Sent from the PostgreSQL - bugs mailing list archive at Nabble.com. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs