summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRobert Haas2016-04-05 20:06:15 +0000
committerRobert Haas2016-04-05 20:06:15 +0000
commit41ea0c23761ca108e2f08f6e3151e3cb1f9652a1 (patch)
tree7872e32b41314042e081bb8435379e55d5148cff /src/test
parent09adc9a8c09c9640de05c7023b27fb83c761e91c (diff)
Fix parallel-safety code for parallel aggregation.
has_parallel_hazard() was ignoring the proparallel markings for aggregates, which is no good. Fix that. There was no way to mark an aggregate as actually being parallel-safe, either, so add a PARALLEL option to CREATE AGGREGATE. Patch by me, reviewed by David Rowley.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/create_aggregate.out12
-rw-r--r--src/test/regress/sql/create_aggregate.sql12
2 files changed, 20 insertions, 4 deletions
diff --git a/src/test/regress/expected/create_aggregate.out b/src/test/regress/expected/create_aggregate.out
index dac26982bca..1aba0c62669 100644
--- a/src/test/regress/expected/create_aggregate.out
+++ b/src/test/regress/expected/create_aggregate.out
@@ -20,9 +20,9 @@ CREATE AGGREGATE newsum (
-- zero-argument aggregate
CREATE AGGREGATE newcnt (*) (
sfunc = int8inc, stype = int8,
- initcond = '0'
+ initcond = '0', parallel = safe
);
--- old-style spelling of same
+-- old-style spelling of same (except without parallel-safe; that's too new)
CREATE AGGREGATE oldcnt (
sfunc = int8inc, basetype = 'ANY', stype = int8,
initcond = '0'
@@ -188,6 +188,14 @@ WHERE aggfnoid = 'myavg'::REGPROC;
(1 row)
DROP AGGREGATE myavg (numeric);
+-- invalid: bad parallel-safety marking
+CREATE AGGREGATE mysum (int)
+(
+ stype = int,
+ sfunc = int4pl,
+ parallel = pear
+);
+ERROR: parameter "parallel" must be SAFE, RESTRICTED, or UNSAFE
-- invalid: nonstrict inverse with strict forward function
CREATE FUNCTION float8mi_n(float8, float8) RETURNS float8 AS
$$ SELECT $1 - $2; $$
diff --git a/src/test/regress/sql/create_aggregate.sql b/src/test/regress/sql/create_aggregate.sql
index a7da31e5943..c98c154a829 100644
--- a/src/test/regress/sql/create_aggregate.sql
+++ b/src/test/regress/sql/create_aggregate.sql
@@ -23,10 +23,10 @@ CREATE AGGREGATE newsum (
-- zero-argument aggregate
CREATE AGGREGATE newcnt (*) (
sfunc = int8inc, stype = int8,
- initcond = '0'
+ initcond = '0', parallel = safe
);
--- old-style spelling of same
+-- old-style spelling of same (except without parallel-safe; that's too new)
CREATE AGGREGATE oldcnt (
sfunc = int8inc, basetype = 'ANY', stype = int8,
initcond = '0'
@@ -201,6 +201,14 @@ WHERE aggfnoid = 'myavg'::REGPROC;
DROP AGGREGATE myavg (numeric);
+-- invalid: bad parallel-safety marking
+CREATE AGGREGATE mysum (int)
+(
+ stype = int,
+ sfunc = int4pl,
+ parallel = pear
+);
+
-- invalid: nonstrict inverse with strict forward function
CREATE FUNCTION float8mi_n(float8, float8) RETURNS float8 AS