Skip to content

Commit 14a254f

Browse files
committed
Test parallel query essentials in "make check".
Clément Prévost and Peter Eisentraut
1 parent c588df9 commit 14a254f

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
--
2+
-- PARALLEL
3+
--
4+
-- Serializable isolation would disable parallel query, so explicitly use an
5+
-- arbitrary other level.
6+
begin isolation level repeatable read;
7+
-- setup parallel test
8+
set parallel_setup_cost=0;
9+
set parallel_tuple_cost=0;
10+
explain (costs off)
11+
select count(*) from a_star;
12+
QUERY PLAN
13+
-----------------------------------------------------
14+
Finalize Aggregate
15+
-> Gather
16+
Workers Planned: 1
17+
-> Partial Aggregate
18+
-> Append
19+
-> Parallel Seq Scan on a_star
20+
-> Parallel Seq Scan on b_star
21+
-> Parallel Seq Scan on c_star
22+
-> Parallel Seq Scan on d_star
23+
-> Parallel Seq Scan on e_star
24+
-> Parallel Seq Scan on f_star
25+
(11 rows)
26+
27+
select count(*) from a_star;
28+
count
29+
-------
30+
50
31+
(1 row)
32+
33+
set force_parallel_mode=1;
34+
explain (costs off)
35+
select stringu1::int2 from tenk1 where unique1 = 1;
36+
QUERY PLAN
37+
-----------------------------------------------
38+
Gather
39+
Workers Planned: 1
40+
Single Copy: true
41+
-> Index Scan using tenk1_unique1 on tenk1
42+
Index Cond: (unique1 = 1)
43+
(5 rows)
44+
45+
do $$begin
46+
-- Provoke error in worker. The original message CONTEXT contains a worker
47+
-- PID that must be hidden in the test output. PL/pgSQL conveniently
48+
-- substitutes its own CONTEXT.
49+
select stringu1::int2 from tenk1 where unique1 = 1;
50+
end$$;
51+
ERROR: invalid input syntax for integer: "BAAAAA"
52+
CONTEXT: SQL statement "select stringu1::int2 from tenk1 where unique1 = 1"
53+
PL/pgSQL function inline_code_block line 5 at SQL statement
54+
rollback;

src/test/regress/parallel_schedule

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ test: brin gin gist spgist privileges init_privs security_label collate matview
9292
test: alter_generic alter_operator misc psql async dbsize misc_functions
9393

9494
# rules cannot run concurrently with any test that creates a view
95-
test: rules psql_crosstab
95+
test: rules psql_crosstab select_parallel
9696

9797
# ----------
9898
# Another group of parallel tests

src/test/regress/serial_schedule

+1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ test: dbsize
125125
test: misc_functions
126126
test: rules
127127
test: psql_crosstab
128+
test: select_parallel
128129
test: select_views
129130
test: portals_p2
130131
test: foreign_key
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--
2+
-- PARALLEL
3+
--
4+
5+
-- Serializable isolation would disable parallel query, so explicitly use an
6+
-- arbitrary other level.
7+
begin isolation level repeatable read;
8+
9+
-- setup parallel test
10+
set parallel_setup_cost=0;
11+
set parallel_tuple_cost=0;
12+
13+
explain (costs off)
14+
select count(*) from a_star;
15+
select count(*) from a_star;
16+
17+
set force_parallel_mode=1;
18+
19+
explain (costs off)
20+
select stringu1::int2 from tenk1 where unique1 = 1;
21+
22+
do $$begin
23+
-- Provoke error in worker. The original message CONTEXT contains a worker
24+
-- PID that must be hidden in the test output. PL/pgSQL conveniently
25+
-- substitutes its own CONTEXT.
26+
select stringu1::int2 from tenk1 where unique1 = 1;
27+
end$$;
28+
29+
rollback;

0 commit comments

Comments
 (0)