Update intagg extension for parallel query.

All functions provided by this extension are PARALLEL SAFE.

Andreas Karlsson
This commit is contained in:
Robert Haas 2016-06-07 11:25:55 -04:00
parent ffab82fbda
commit 1ab194a3a9
4 changed files with 20 additions and 7 deletions

View File

@ -1,7 +1,7 @@
# contrib/intagg/Makefile # contrib/intagg/Makefile
EXTENSION = intagg EXTENSION = intagg
DATA = intagg--1.0.sql intagg--unpackaged--1.0.sql DATA = intagg--1.1.sql intagg--1.0--1.1.sql intagg--unpackaged--1.0.sql
ifdef USE_PGXS ifdef USE_PGXS
PG_CONFIG = pg_config PG_CONFIG = pg_config

View File

@ -0,0 +1,11 @@
/* contrib/intagg/intagg--1.0--1.1.sql */
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
\echo Use "ALTER EXTENSION intagg UPDATE TO '1.1'" to load this file. \quit
ALTER FUNCTION int_agg_state(internal, int4) PARALLEL SAFE;
ALTER FUNCTION int_agg_final_array(internal) PARALLEL SAFE;
ALTER FUNCTION int_array_enum(int4[]) PARALLEL SAFE;
UPDATE pg_proc SET proparallel = 's'
WHERE oid = 'int_array_aggregate(int4)'::regprocedure;

View File

@ -1,4 +1,4 @@
/* contrib/intagg/intagg--1.0.sql */ /* contrib/intagg/intagg--1.1.sql */
-- complain if script is sourced in psql, rather than via CREATE EXTENSION -- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION intagg" to load this file. \quit \echo Use "CREATE EXTENSION intagg" to load this file. \quit
@ -8,6 +8,7 @@
CREATE FUNCTION int_agg_state (internal, int4) CREATE FUNCTION int_agg_state (internal, int4)
RETURNS internal RETURNS internal
AS 'array_agg_transfn' AS 'array_agg_transfn'
PARALLEL SAFE
LANGUAGE INTERNAL; LANGUAGE INTERNAL;
-- Internal function for the aggregate -- Internal function for the aggregate
@ -15,15 +16,16 @@ LANGUAGE INTERNAL;
CREATE FUNCTION int_agg_final_array (internal) CREATE FUNCTION int_agg_final_array (internal)
RETURNS int4[] RETURNS int4[]
AS 'array_agg_finalfn' AS 'array_agg_finalfn'
PARALLEL SAFE
LANGUAGE INTERNAL; LANGUAGE INTERNAL;
-- The aggregate function itself -- The aggregate function itself
-- uses the above functions to create an array of integers from an aggregation. -- uses the above functions to create an array of integers from an aggregation.
CREATE AGGREGATE int_array_aggregate ( CREATE AGGREGATE int_array_aggregate(int4) (
BASETYPE = int4,
SFUNC = int_agg_state, SFUNC = int_agg_state,
STYPE = internal, STYPE = internal,
FINALFUNC = int_agg_final_array FINALFUNC = int_agg_final_array,
PARALLEL = SAFE
); );
-- The enumeration function -- The enumeration function
@ -32,4 +34,4 @@ CREATE AGGREGATE int_array_aggregate (
CREATE FUNCTION int_array_enum(int4[]) CREATE FUNCTION int_array_enum(int4[])
RETURNS setof integer RETURNS setof integer
AS 'array_unnest' AS 'array_unnest'
LANGUAGE INTERNAL IMMUTABLE STRICT; LANGUAGE INTERNAL IMMUTABLE STRICT PARALLEL SAFE;

View File

@ -1,4 +1,4 @@
# intagg extension # intagg extension
comment = 'integer aggregator and enumerator (obsolete)' comment = 'integer aggregator and enumerator (obsolete)'
default_version = '1.0' default_version = '1.1'
relocatable = true relocatable = true