1 /* contrib/intagg/intagg--1.1.sql */
3 -- complain if script is sourced in psql, rather than via CREATE EXTENSION
4 \echo Use "CREATE EXTENSION intagg" to load this file. \quit
6 -- Internal function for the aggregate
7 -- Is called for each item in an aggregation
8 CREATE FUNCTION int_agg_state (internal, int4)
10 AS 'array_agg_transfn'
14 -- Internal function for the aggregate
15 -- Is called at the end of the aggregation, and returns an array.
16 CREATE FUNCTION int_agg_final_array (internal)
18 AS 'array_agg_finalfn'
22 -- The aggregate function itself
23 -- uses the above functions to create an array of integers from an aggregation.
24 CREATE AGGREGATE int_array_aggregate(int4) (
25 SFUNC = int_agg_state,
27 FINALFUNC = int_agg_final_array,
31 -- The enumeration function
32 -- returns each element in a one dimensional integer array
34 CREATE FUNCTION int_array_enum(int4[])
37 LANGUAGE INTERNAL IMMUTABLE STRICT PARALLEL SAFE;