Re: [sqlsmith] ERROR: plan should not reference subplan's variable

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andreas Seltenreich <seltenreich(at)gmx(dot)de>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [sqlsmith] ERROR: plan should not reference subplan's variable
Date: 2016-07-01 22:52:31
Message-ID: 14046.1467413551@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Fri, Jul 1, 2016 at 5:29 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Karl O. Pinc 2016-07-01 23:56:21 Re: Patch to implement pg_current_logfile() function
Previous Message Robert Haas 2016-07-01 22:18:22 Re: [sqlsmith] ERROR: plan should not reference subplan's variable