Skip to content

Commit 0fd6a8a

Browse files
author
Amit Kapila
committed
Test passing expanded-value representations to workers.
Currently, we don't have an explicit test to pass expanded-value representations to workers, so we don't know whether it works on all kind of platforms. We suspect that the current code won't work on alignment-sensitive hardware. This commit will test that aspect and can lead to failure on some of the buildfarm machines which we will fix in the later commit. Author: Tom Lane and Amit Kapila Discussion: https://postgr.es/m/11629.1536550032@sss.pgh.pa.us
1 parent e3a25ab commit 0fd6a8a

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

src/test/regress/expected/select_parallel.out

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,34 @@ ORDER BY 1, 2, 3;
10881088
------------------------------+---------------------------+-------------+--------------
10891089
(0 rows)
10901090

1091-
-- test interation between subquery and partial_paths
1091+
-- test passing expanded-value representations to workers
1092+
CREATE FUNCTION make_some_array(int,int) returns int[] as
1093+
$$declare x int[];
1094+
begin
1095+
x[1] := $1;
1096+
x[2] := $2;
1097+
return x;
1098+
end$$ language plpgsql parallel safe;
1099+
CREATE TABLE fooarr(f1 text, f2 int[], f3 text);
1100+
INSERT INTO fooarr VALUES('1', ARRAY[1,2], 'one');
1101+
PREPARE pstmt(text, int[]) AS SELECT * FROM fooarr WHERE f1 = $1 AND f2 = $2;
1102+
EXPLAIN (COSTS OFF) EXECUTE pstmt('1', make_some_array(1,2));
1103+
QUERY PLAN
1104+
------------------------------------------------------------------
1105+
Gather
1106+
Workers Planned: 3
1107+
-> Parallel Seq Scan on fooarr
1108+
Filter: ((f1 = '1'::text) AND (f2 = '{1,2}'::integer[]))
1109+
(4 rows)
1110+
1111+
EXECUTE pstmt('1', make_some_array(1,2));
1112+
f1 | f2 | f3
1113+
----+-------+-----
1114+
1 | {1,2} | one
1115+
(1 row)
1116+
1117+
DEALLOCATE pstmt;
1118+
-- test interaction between subquery and partial_paths
10921119
SET LOCAL min_parallel_table_scan_size TO 0;
10931120
CREATE VIEW tenk1_vw_sec WITH (security_barrier) AS SELECT * FROM tenk1;
10941121
EXPLAIN (COSTS OFF)

src/test/regress/sql/select_parallel.sql

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,23 @@ ORDER BY 1;
410410
SELECT * FROM information_schema.foreign_data_wrapper_options
411411
ORDER BY 1, 2, 3;
412412

413-
-- test interation between subquery and partial_paths
413+
-- test passing expanded-value representations to workers
414+
CREATE FUNCTION make_some_array(int,int) returns int[] as
415+
$$declare x int[];
416+
begin
417+
x[1] := $1;
418+
x[2] := $2;
419+
return x;
420+
end$$ language plpgsql parallel safe;
421+
CREATE TABLE fooarr(f1 text, f2 int[], f3 text);
422+
INSERT INTO fooarr VALUES('1', ARRAY[1,2], 'one');
423+
424+
PREPARE pstmt(text, int[]) AS SELECT * FROM fooarr WHERE f1 = $1 AND f2 = $2;
425+
EXPLAIN (COSTS OFF) EXECUTE pstmt('1', make_some_array(1,2));
426+
EXECUTE pstmt('1', make_some_array(1,2));
427+
DEALLOCATE pstmt;
428+
429+
-- test interaction between subquery and partial_paths
414430
SET LOCAL min_parallel_table_scan_size TO 0;
415431
CREATE VIEW tenk1_vw_sec WITH (security_barrier) AS SELECT * FROM tenk1;
416432
EXPLAIN (COSTS OFF)

0 commit comments

Comments
 (0)