Make aggregate serialize and deserialize functions STRICT

Aggregate functions that have serialize and deserialize support
functions (histogram, last, first, etc.) should have these
support functions marked STRICT.

PostgreSQL's regular test suite will fail when the timescaledb
module is loaded without these functions being marked STRICT.
This commit is contained in:
Erik Nordström 2017-11-17 12:13:28 +01:00 committed by Erik Nordström
parent c552410f69
commit 2ffb30d990
2 changed files with 4 additions and 6 deletions

View File

@ -26,12 +26,12 @@ LANGUAGE C IMMUTABLE;
CREATE OR REPLACE FUNCTION _timescaledb_internal.bookend_serializefunc(internal)
RETURNS bytea
AS '$libdir/timescaledb', 'bookend_serializefunc'
LANGUAGE C IMMUTABLE;
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION _timescaledb_internal.bookend_deserializefunc(bytea, internal)
RETURNS internal
AS '$libdir/timescaledb', 'bookend_deserializefunc'
LANGUAGE C IMMUTABLE;
LANGUAGE C IMMUTABLE STRICT;
--This aggregate returns the "first" element of the first argument when ordered by the second argument.
--Ex. first(temp, time) returns the temp value for the row with the lowest time
@ -60,5 +60,3 @@ CREATE AGGREGATE last(anyelement, "any") (
FINALFUNC = _timescaledb_internal.bookend_finalfunc,
FINALFUNC_EXTRA
);

View File

@ -11,12 +11,12 @@ LANGUAGE C IMMUTABLE;
CREATE OR REPLACE FUNCTION _timescaledb_internal.hist_serializefunc(INTERNAL)
RETURNS bytea
AS '$libdir/timescaledb', 'hist_serializefunc'
LANGUAGE C IMMUTABLE;
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION _timescaledb_internal.hist_deserializefunc(bytea, INTERNAL)
RETURNS INTERNAL
AS '$libdir/timescaledb', 'hist_deserializefunc'
LANGUAGE C IMMUTABLE;
LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION _timescaledb_internal.hist_finalfunc(state INTERNAL, val DOUBLE PRECISION, MIN DOUBLE PRECISION, MAX DOUBLE PRECISION, nbuckets INTEGER)
RETURNS INTEGER[]