1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Just some fixups to a couple contrib directories I was trying out.

. replace CREATE OR REPLACE AGGREGATE with a separate DROP and CREATE
. add DROP for all CREATE OPERATORs
. use IMMUTABLE and STRICT instead of WITH (isStrict)
. add IMMUTABLE and STRICT to int_array_aggregate's accumulator function

Gregory Stark
This commit is contained in:
Bruce Momjian
2003-03-20 04:39:27 +00:00
parent 900fa3d0f5
commit ee303739d3
2 changed files with 65 additions and 34 deletions

View File

@ -8,18 +8,19 @@ SET autocommit TO 'on';
CREATE OR REPLACE FUNCTION int_agg_state (int4, int4)
RETURNS int4
AS 'MODULE_PATHNAME','int_agg_state'
LANGUAGE 'C';
LANGUAGE 'C' IMMUTABLE STRICT;
-- Internal function for the aggregate
-- Is called at the end of the aggregation, and returns an array.
CREATE OR REPLACE FUNCTION int_agg_final_array (int4)
RETURNS int4[]
AS 'MODULE_PATHNAME','int_agg_final_array'
LANGUAGE 'C';
LANGUAGE 'C' IMMUTABLE STRICT;
-- The aggration funcion.
-- uses the above functions to create an array of integers from an aggregation.
CREATE OR REPLACE AGGREGATE int_array_aggregate (
DROP AGGREGATE int_array_aggregate(int4);
CREATE AGGREGATE int_array_aggregate (
BASETYPE = int4,
SFUNC = int_agg_state,
STYPE = int4,
@ -33,4 +34,4 @@ CREATE OR REPLACE AGGREGATE int_array_aggregate (
CREATE OR REPLACE FUNCTION int_array_enum(int4[])
RETURNS setof integer
AS 'MODULE_PATHNAME','int_enum'
LANGUAGE 'C';
LANGUAGE 'C' IMMUTABLE STRICT;