Commit 90d8f1b1 authored by David Rowley's avatar David Rowley

Fix unstable partition_prune regression tests

This was broken recently by a929e17e.  I'd failed to remember that
parallel tests should have their EXPLAIN output run through the
explain_parallel_append function so that the output is stable when
parallel workers fail to start.

fairywren was first to notice.

Reported-by: Michael Paquier
Discussion: https://postgr.es/m/20201102062951.GB15770@paquier.xyz
parent 8a15e735
...@@ -3684,18 +3684,17 @@ create table listp_12_2 partition of listp_12 for values in(2); ...@@ -3684,18 +3684,17 @@ create table listp_12_2 partition of listp_12 for values in(2);
alter table listp_12_1 set (parallel_workers = 0); alter table listp_12_1 set (parallel_workers = 0);
-- Ensure that listp_12_2 is not scanned. (The nested Append is not seen in -- Ensure that listp_12_2 is not scanned. (The nested Append is not seen in
-- the plan as it's pulled in setref.c due to having just a single subnode). -- the plan as it's pulled in setref.c due to having just a single subnode).
explain (analyze on, costs off, timing off, summary off) select explain_parallel_append('select * from listp where a = (select 1);');
select * from listp where a = (select 1); explain_parallel_append
QUERY PLAN
---------------------------------------------------------------------- ----------------------------------------------------------------------
Gather (actual rows=0 loops=1) Gather (actual rows=N loops=N)
Workers Planned: 2 Workers Planned: 2
Params Evaluated: $0 Params Evaluated: $0
Workers Launched: 2 Workers Launched: N
InitPlan 1 (returns $0) InitPlan 1 (returns $0)
-> Result (actual rows=1 loops=1) -> Result (actual rows=N loops=N)
-> Parallel Append (actual rows=0 loops=3) -> Parallel Append (actual rows=N loops=N)
-> Seq Scan on listp_12_1 listp_1 (actual rows=0 loops=1) -> Seq Scan on listp_12_1 listp_1 (actual rows=N loops=N)
Filter: (a = $0) Filter: (a = $0)
-> Parallel Seq Scan on listp_12_2 listp_2 (never executed) -> Parallel Seq Scan on listp_12_2 listp_2 (never executed)
Filter: (a = $0) Filter: (a = $0)
...@@ -3704,34 +3703,34 @@ select * from listp where a = (select 1); ...@@ -3704,34 +3703,34 @@ select * from listp where a = (select 1);
-- Like the above but throw some more complexity at the planner by adding -- Like the above but throw some more complexity at the planner by adding
-- a UNION ALL. We expect both sides of the union not to scan the -- a UNION ALL. We expect both sides of the union not to scan the
-- non-required partitions. -- non-required partitions.
explain (analyze on, costs off, timing off, summary off) select explain_parallel_append(
select * from listp where a = (select 1) 'select * from listp where a = (select 1)
union all union all
select * from listp where a = (select 2); select * from listp where a = (select 2);');
QUERY PLAN explain_parallel_append
----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
Append (actual rows=0 loops=1) Append (actual rows=N loops=N)
-> Gather (actual rows=0 loops=1) -> Gather (actual rows=N loops=N)
Workers Planned: 2 Workers Planned: 2
Params Evaluated: $0 Params Evaluated: $0
Workers Launched: 2 Workers Launched: N
InitPlan 1 (returns $0) InitPlan 1 (returns $0)
-> Result (actual rows=1 loops=1) -> Result (actual rows=N loops=N)
-> Parallel Append (actual rows=0 loops=3) -> Parallel Append (actual rows=N loops=N)
-> Seq Scan on listp_12_1 listp_1 (actual rows=0 loops=1) -> Seq Scan on listp_12_1 listp_1 (actual rows=N loops=N)
Filter: (a = $0) Filter: (a = $0)
-> Parallel Seq Scan on listp_12_2 listp_2 (never executed) -> Parallel Seq Scan on listp_12_2 listp_2 (never executed)
Filter: (a = $0) Filter: (a = $0)
-> Gather (actual rows=0 loops=1) -> Gather (actual rows=N loops=N)
Workers Planned: 2 Workers Planned: 2
Params Evaluated: $1 Params Evaluated: $1
Workers Launched: 2 Workers Launched: N
InitPlan 2 (returns $1) InitPlan 2 (returns $1)
-> Result (actual rows=1 loops=1) -> Result (actual rows=N loops=N)
-> Parallel Append (actual rows=0 loops=3) -> Parallel Append (actual rows=N loops=N)
-> Seq Scan on listp_12_1 listp_4 (never executed) -> Seq Scan on listp_12_1 listp_4 (never executed)
Filter: (a = $1) Filter: (a = $1)
-> Parallel Seq Scan on listp_12_2 listp_5 (actual rows=0 loops=1) -> Parallel Seq Scan on listp_12_2 listp_5 (actual rows=N loops=N)
Filter: (a = $1) Filter: (a = $1)
(23 rows) (23 rows)
......
...@@ -1067,16 +1067,15 @@ alter table listp_12_1 set (parallel_workers = 0); ...@@ -1067,16 +1067,15 @@ alter table listp_12_1 set (parallel_workers = 0);
-- Ensure that listp_12_2 is not scanned. (The nested Append is not seen in -- Ensure that listp_12_2 is not scanned. (The nested Append is not seen in
-- the plan as it's pulled in setref.c due to having just a single subnode). -- the plan as it's pulled in setref.c due to having just a single subnode).
explain (analyze on, costs off, timing off, summary off) select explain_parallel_append('select * from listp where a = (select 1);');
select * from listp where a = (select 1);
-- Like the above but throw some more complexity at the planner by adding -- Like the above but throw some more complexity at the planner by adding
-- a UNION ALL. We expect both sides of the union not to scan the -- a UNION ALL. We expect both sides of the union not to scan the
-- non-required partitions. -- non-required partitions.
explain (analyze on, costs off, timing off, summary off) select explain_parallel_append(
select * from listp where a = (select 1) 'select * from listp where a = (select 1)
union all union all
select * from listp where a = (select 2); select * from listp where a = (select 2);');
drop table listp; drop table listp;
reset parallel_tuple_cost; reset parallel_tuple_cost;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment