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

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

Andreas Seltenreich <seltenreich(at)gmx(dot)de> writes:
> Updating master from f8c5855..1bdae16, sqlsmith triggers "failed to
> generate plan" errors again. Below is the smallest query logged so far.

Hmm, interesting. This can be reduced to

set force_parallel_mode = on;

explain
with j1 as (select * from int8_tbl)
select * from int4_tbl
where false and EXISTS (select 1 as c0 from j1);

The "plan should not reference subplan's variable" fail seems to be due
to ancient fuzzy thinking in SS_finalize_plan. When I fix that, I get
a plan like so:

Gather (cost=0.00..0.00 rows=0 width=0)
Workers Planned: 1
Single Copy: true
-> Result (cost=1.05..1.05 rows=0 width=4)
One-Time Filter: false
CTE j1
-> Seq Scan on int8_tbl (cost=0.00..1.05 rows=5 width=16)

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.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2016-07-01 21:34:03 Re: Comment and function argument names are mismatched in bugmgr.c.
Previous Message Peter Geoghegan 2016-07-01 21:18:07 Re: _mdfd_getseg can be expensive