Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id EC25C133FFA6 for ; Sat, 28 Jan 2012 18:59:55 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RrHFP-0006rD-S3 for pgsql-bugs@postgresql.org; Sat, 28 Jan 2012 22:59:56 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q0SMxc00005051; Sat, 28 Jan 2012 17:59:38 -0500 (EST) To: Phil Sorber cc: pgsql-bugs@postgresql.org Subject: Re: Segfault in backend CTE code In-reply-to: References: <20955.1327383788@sss.pgh.pa.us> <6418.1327438984@sss.pgh.pa.us> <12620.1327529624@sss.pgh.pa.us> Comments: In-reply-to Phil Sorber message dated "Fri, 27 Jan 2012 15:02:57 -0500" Date: Sat, 28 Jan 2012 17:59:38 -0500 Message-ID: <5050.1327791578@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201201/224 X-Sequence-Number: 32291 Phil Sorber writes: > On Wed, Jan 25, 2012 at 5:13 PM, Tom Lane wrote: > I played around with removing the optimization, but there are other > pieces further down the line that are upset but having a ModifyTable > node in the execution tree. Hm, yeah, obviously this scenario has never been tested :-(. I have applied a patch for it, and also done some work so that it will get tested by the buildfarm in future. Thanks for the report! > We changed our writable CTE queries to update/insert loops so this is > no longer a blocker for us. FWIW, that technique didn't really work anyway, as even with the patch I observe that you get a "duplicate unique key" failure if two such commands try to insert a new row concurrently. This is because neither UPDATE subquery will see an as-yet-uncommitted inserted row. regards, tom lane