Skip to content

Commit 90d8f1b

Browse files
committed
Fix unstable partition_prune regression tests
This was broken recently by a929e17. 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
1 parent 8a15e73 commit 90d8f1b

File tree

2 files changed

+26
-28
lines changed

2 files changed

+26
-28
lines changed

src/test/regress/expected/partition_prune.out

+22-23
Original file line numberDiff line numberDiff line change
@@ -3684,18 +3684,17 @@ create table listp_12_2 partition of listp_12 for values in(2);
36843684
alter table listp_12_1 set (parallel_workers = 0);
36853685
-- Ensure that listp_12_2 is not scanned. (The nested Append is not seen in
36863686
-- the plan as it's pulled in setref.c due to having just a single subnode).
3687-
explain (analyze on, costs off, timing off, summary off)
3688-
select * from listp where a = (select 1);
3689-
QUERY PLAN
3687+
select explain_parallel_append('select * from listp where a = (select 1);');
3688+
explain_parallel_append
36903689
----------------------------------------------------------------------
3691-
Gather (actual rows=0 loops=1)
3690+
Gather (actual rows=N loops=N)
36923691
Workers Planned: 2
36933692
Params Evaluated: $0
3694-
Workers Launched: 2
3693+
Workers Launched: N
36953694
InitPlan 1 (returns $0)
3696-
-> Result (actual rows=1 loops=1)
3697-
-> Parallel Append (actual rows=0 loops=3)
3698-
-> Seq Scan on listp_12_1 listp_1 (actual rows=0 loops=1)
3695+
-> Result (actual rows=N loops=N)
3696+
-> Parallel Append (actual rows=N loops=N)
3697+
-> Seq Scan on listp_12_1 listp_1 (actual rows=N loops=N)
36993698
Filter: (a = $0)
37003699
-> Parallel Seq Scan on listp_12_2 listp_2 (never executed)
37013700
Filter: (a = $0)
@@ -3704,34 +3703,34 @@ select * from listp where a = (select 1);
37043703
-- Like the above but throw some more complexity at the planner by adding
37053704
-- a UNION ALL. We expect both sides of the union not to scan the
37063705
-- non-required partitions.
3707-
explain (analyze on, costs off, timing off, summary off)
3708-
select * from listp where a = (select 1)
3706+
select explain_parallel_append(
3707+
'select * from listp where a = (select 1)
37093708
union all
3710-
select * from listp where a = (select 2);
3711-
QUERY PLAN
3709+
select * from listp where a = (select 2);');
3710+
explain_parallel_append
37123711
-----------------------------------------------------------------------------------
3713-
Append (actual rows=0 loops=1)
3714-
-> Gather (actual rows=0 loops=1)
3712+
Append (actual rows=N loops=N)
3713+
-> Gather (actual rows=N loops=N)
37153714
Workers Planned: 2
37163715
Params Evaluated: $0
3717-
Workers Launched: 2
3716+
Workers Launched: N
37183717
InitPlan 1 (returns $0)
3719-
-> Result (actual rows=1 loops=1)
3720-
-> Parallel Append (actual rows=0 loops=3)
3721-
-> Seq Scan on listp_12_1 listp_1 (actual rows=0 loops=1)
3718+
-> Result (actual rows=N loops=N)
3719+
-> Parallel Append (actual rows=N loops=N)
3720+
-> Seq Scan on listp_12_1 listp_1 (actual rows=N loops=N)
37223721
Filter: (a = $0)
37233722
-> Parallel Seq Scan on listp_12_2 listp_2 (never executed)
37243723
Filter: (a = $0)
3725-
-> Gather (actual rows=0 loops=1)
3724+
-> Gather (actual rows=N loops=N)
37263725
Workers Planned: 2
37273726
Params Evaluated: $1
3728-
Workers Launched: 2
3727+
Workers Launched: N
37293728
InitPlan 2 (returns $1)
3730-
-> Result (actual rows=1 loops=1)
3731-
-> Parallel Append (actual rows=0 loops=3)
3729+
-> Result (actual rows=N loops=N)
3730+
-> Parallel Append (actual rows=N loops=N)
37323731
-> Seq Scan on listp_12_1 listp_4 (never executed)
37333732
Filter: (a = $1)
3734-
-> Parallel Seq Scan on listp_12_2 listp_5 (actual rows=0 loops=1)
3733+
-> Parallel Seq Scan on listp_12_2 listp_5 (actual rows=N loops=N)
37353734
Filter: (a = $1)
37363735
(23 rows)
37373736

src/test/regress/sql/partition_prune.sql

+4-5
Original file line numberDiff line numberDiff line change
@@ -1067,16 +1067,15 @@ alter table listp_12_1 set (parallel_workers = 0);
10671067

10681068
-- Ensure that listp_12_2 is not scanned. (The nested Append is not seen in
10691069
-- the plan as it's pulled in setref.c due to having just a single subnode).
1070-
explain (analyze on, costs off, timing off, summary off)
1071-
select * from listp where a = (select 1);
1070+
select explain_parallel_append('select * from listp where a = (select 1);');
10721071

10731072
-- Like the above but throw some more complexity at the planner by adding
10741073
-- a UNION ALL. We expect both sides of the union not to scan the
10751074
-- non-required partitions.
1076-
explain (analyze on, costs off, timing off, summary off)
1077-
select * from listp where a = (select 1)
1075+
select explain_parallel_append(
1076+
'select * from listp where a = (select 1)
10781077
union all
1079-
select * from listp where a = (select 2);
1078+
select * from listp where a = (select 2);');
10801079

10811080
drop table listp;
10821081
reset parallel_tuple_cost;

0 commit comments

Comments
 (0)