Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1ab194a

Browse files
committed
Update intagg extension for parallel query.
All functions provided by this extension are PARALLEL SAFE. Andreas Karlsson
1 parent ffab82f commit 1ab194a

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

contrib/intagg/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# contrib/intagg/Makefile
22

33
EXTENSION = intagg
4-
DATA = intagg--1.0.sql intagg--unpackaged--1.0.sql
4+
DATA = intagg--1.1.sql intagg--1.0--1.1.sql intagg--unpackaged--1.0.sql
55

66
ifdef USE_PGXS
77
PG_CONFIG = pg_config

contrib/intagg/intagg--1.0--1.1.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* contrib/intagg/intagg--1.0--1.1.sql */
2+
3+
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
4+
\echo Use "ALTER EXTENSION intagg UPDATE TO '1.1'" to load this file. \quit
5+
6+
ALTER FUNCTION int_agg_state(internal, int4) PARALLEL SAFE;
7+
ALTER FUNCTION int_agg_final_array(internal) PARALLEL SAFE;
8+
ALTER FUNCTION int_array_enum(int4[]) PARALLEL SAFE;
9+
10+
UPDATE pg_proc SET proparallel = 's'
11+
WHERE oid = 'int_array_aggregate(int4)'::regprocedure;
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* contrib/intagg/intagg--1.0.sql */
1+
/* contrib/intagg/intagg--1.1.sql */
22

33
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
44
\echo Use "CREATE EXTENSION intagg" to load this file. \quit
@@ -8,22 +8,24 @@
88
CREATE FUNCTION int_agg_state (internal, int4)
99
RETURNS internal
1010
AS 'array_agg_transfn'
11+
PARALLEL SAFE
1112
LANGUAGE INTERNAL;
1213

1314
-- Internal function for the aggregate
1415
-- Is called at the end of the aggregation, and returns an array.
1516
CREATE FUNCTION int_agg_final_array (internal)
1617
RETURNS int4[]
1718
AS 'array_agg_finalfn'
19+
PARALLEL SAFE
1820
LANGUAGE INTERNAL;
1921

2022
-- The aggregate function itself
2123
-- uses the above functions to create an array of integers from an aggregation.
22-
CREATE AGGREGATE int_array_aggregate (
23-
BASETYPE = int4,
24+
CREATE AGGREGATE int_array_aggregate(int4) (
2425
SFUNC = int_agg_state,
2526
STYPE = internal,
26-
FINALFUNC = int_agg_final_array
27+
FINALFUNC = int_agg_final_array,
28+
PARALLEL = SAFE
2729
);
2830

2931
-- The enumeration function
@@ -32,4 +34,4 @@ CREATE AGGREGATE int_array_aggregate (
3234
CREATE FUNCTION int_array_enum(int4[])
3335
RETURNS setof integer
3436
AS 'array_unnest'
35-
LANGUAGE INTERNAL IMMUTABLE STRICT;
37+
LANGUAGE INTERNAL IMMUTABLE STRICT PARALLEL SAFE;

contrib/intagg/intagg.control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# intagg extension
22
comment = 'integer aggregator and enumerator (obsolete)'
3-
default_version = '1.0'
3+
default_version = '1.1'
44
relocatable = true

0 commit comments

Comments
 (0)