Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJ7Im-00083p-L1 for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Jul 2016 22:52:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bJ7Ik-0000mO-Mh for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Jul 2016 22:52:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bJ7Ii-0000lh-Es for pgsql-hackers@postgresql.org; Fri, 01 Jul 2016 22:52:44 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bJ7Ib-0002nO-Bl for pgsql-hackers@postgresql.org; Fri, 01 Jul 2016 22:52:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u61MqVDu014047; Fri, 1 Jul 2016 18:52:31 -0400 From: Tom Lane To: Robert Haas cc: Andreas Seltenreich , "pgsql-hackers@postgresql.org" Subject: Re: [sqlsmith] ERROR: plan should not reference subplan's variable In-reply-to: References: <874m89rw7x.fsf@credativ.de> <8425.1467408576@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Fri, 01 Jul 2016 18:18:22 -0400" Date: Fri, 01 Jul 2016 18:52:31 -0400 Message-ID: <14046.1467413551@sss.pgh.pa.us> X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Robert Haas writes: > On Fri, Jul 1, 2016 at 5:29 PM, Tom Lane wrote: >> ... but if I try to actually execute the query, it crashes at runtime, >> apparently because the CTE has not been passed over to the parallel >> worker. Robert, is it expected that CTEs should be parallel-safe? >> I'd have thought not. > Not. See the RTE_CTE case in set_rel_consider_parallel. OK; but this is crashing anyway, because after const-simplification the CTE isn't actually referenced anywhere. But it still ends up as an initplan attached to the top plan node. This may have accidentally failed to fail before you removed this bit in 5ce5e4a12: if (glob->subplans != NULL) glob->wholePlanParallelSafe = false; I think in the current code, the equivalent thing is that we need to consider that a plan node is parallel-unsafe once we've stuck some initPlans on it (which happens only in createplan.c and so doesn't affect the parallel_safe state of the source Path). Will see if that helps. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers