Skip to content

Commit 32cc9e5

Browse files
committed
Reduce contrib/intagg to a thin wrapper around the new core functions
array_agg() and unnest(). We could drop it entirely in the future, but let's keep it for a release or two as a compatibility assist.
1 parent 9e0247a commit 32cc9e5

File tree

5 files changed

+25
-321
lines changed

5 files changed

+25
-321
lines changed

contrib/intagg/Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
# Makefile for integer aggregator
33
# Copyright (C) 2001 Digital Music Network.
44
# by Mark L. Woodward
5-
# $PostgreSQL: pgsql/contrib/intagg/Makefile,v 1.9 2007/11/10 23:59:51 momjian Exp $
5+
# $PostgreSQL: pgsql/contrib/intagg/Makefile,v 1.10 2008/11/14 19:58:45 tgl Exp $
66

7-
MODULES = int_aggregate
8-
DATA_built = int_aggregate.sql
9-
DATA = uninstall_int_aggregate.sql
7+
DATA = int_aggregate.sql uninstall_int_aggregate.sql
108

119
ifdef USE_PGXS
1210
PG_CONFIG = pg_config

contrib/intagg/int_aggregate.c

Lines changed: 0 additions & 278 deletions
This file was deleted.
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
/* $PostgreSQL: pgsql/contrib/intagg/int_aggregate.sql.in,v 1.9 2007/11/13 04:24:28 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/contrib/intagg/int_aggregate.sql,v 1.1 2008/11/14 19:58:45 tgl Exp $ */
22

33
-- Adjust this setting to control where the objects get created.
44
SET search_path = public;
55

66
-- Internal function for the aggregate
77
-- Is called for each item in an aggregation
8-
CREATE OR REPLACE FUNCTION int_agg_state (int4[], int4)
9-
RETURNS int4[]
10-
AS 'MODULE_PATHNAME','int_agg_state'
11-
LANGUAGE C;
8+
CREATE OR REPLACE FUNCTION int_agg_state (internal, int4)
9+
RETURNS internal
10+
AS 'array_agg_transfn'
11+
LANGUAGE INTERNAL;
1212

1313
-- Internal function for the aggregate
1414
-- Is called at the end of the aggregation, and returns an array.
15-
CREATE OR REPLACE FUNCTION int_agg_final_array (int4[])
15+
CREATE OR REPLACE FUNCTION int_agg_final_array (internal)
1616
RETURNS int4[]
17-
AS 'MODULE_PATHNAME','int_agg_final_array'
18-
LANGUAGE C;
17+
AS 'array_agg_finalfn'
18+
LANGUAGE INTERNAL;
1919

2020
-- The aggregate function itself
2121
-- uses the above functions to create an array of integers from an aggregation.
2222
CREATE AGGREGATE int_array_aggregate (
2323
BASETYPE = int4,
2424
SFUNC = int_agg_state,
25-
STYPE = int4[],
25+
STYPE = internal,
2626
FINALFUNC = int_agg_final_array
2727
);
2828

@@ -31,5 +31,5 @@ CREATE AGGREGATE int_array_aggregate (
3131
-- as a row.
3232
CREATE OR REPLACE FUNCTION int_array_enum(int4[])
3333
RETURNS setof integer
34-
AS 'MODULE_PATHNAME','int_enum'
35-
LANGUAGE C IMMUTABLE STRICT;
34+
AS 'array_unnest'
35+
LANGUAGE INTERNAL IMMUTABLE STRICT;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/contrib/intagg/uninstall_int_aggregate.sql,v 1.3 2007/11/13 04:24:28 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/contrib/intagg/uninstall_int_aggregate.sql,v 1.4 2008/11/14 19:58:45 tgl Exp $ */
22

33
-- Adjust this setting to control where the objects get dropped.
44
SET search_path = public;
@@ -7,6 +7,6 @@ DROP FUNCTION int_array_enum(int4[]);
77

88
DROP AGGREGATE int_array_aggregate (int4);
99

10-
DROP FUNCTION int_agg_final_array (int4[]);
10+
DROP FUNCTION int_agg_final_array (internal);
1111

12-
DROP FUNCTION int_agg_state (int4[], int4);
12+
DROP FUNCTION int_agg_state (internal, int4);

0 commit comments

Comments
 (0)