1
/* contrib/intagg/intagg--1.0.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'
13
-- Internal function for the aggregate
14
-- Is called at the end of the aggregation, and returns an array.
15
CREATE FUNCTION int_agg_final_array (internal)
17
AS 'array_agg_finalfn'
20
-- The aggregate function itself
21
-- uses the above functions to create an array of integers from an aggregation.
22
CREATE AGGREGATE int_array_aggregate (
24
SFUNC = int_agg_state,
26
FINALFUNC = int_agg_final_array
29
-- The enumeration function
30
-- returns each element in a one dimensional integer array
32
CREATE FUNCTION int_array_enum(int4[])
35
LANGUAGE INTERNAL IMMUTABLE STRICT;