Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 45E2A1AEBA99 for ; Tue, 24 Jan 2012 17:03:24 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RpnWR-0004K4-EK for pgsql-bugs@postgresql.org; Tue, 24 Jan 2012 21:03:24 +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 q0OL34dF006419; Tue, 24 Jan 2012 16:03:04 -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> Comments: In-reply-to Phil Sorber message dated "Tue, 24 Jan 2012 15:22:45 -0500" Date: Tue, 24 Jan 2012 16:03:04 -0500 Message-ID: <6418.1327438984@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201201/162 X-Sequence-Number: 32229 Phil Sorber writes: > On Tue, Jan 24, 2012 at 12:43 AM, Tom Lane wrote: >> How about a test case? > We are having trouble coming up with a test case that can reliably > reproduce this. The stack traces run through the EvalPlanQual machinery, which is only going to be entered when attempting to update/delete a row that's been updated by a concurrent transaction. So what I'd suggest for creating a test case is (1) in a psql session, do BEGIN; UPDATE some-target-row; (2) in another psql session, call this function with arguments that will make it try to update that same row; it should block. (3) in the first session, COMMIT to unblock. FWIW, having re-examined your patch with some caffeine in me, I don't think it's right at all. You can't just blow off setting the scan type for a CTEScan node. What it looks like to me is that the EvalPlanQual code is not initializing the new execution tree correctly; but that idea would be a lot easier to check into with a test case. regards, tom lane