From: Sebastian Harl Date: Tue, 23 Oct 2012 10:49:11 +0000 (+0200) Subject: CData: Declared CData_update() as not strict. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ec00d193ed161a58be46f62fed81adfc5612cfde;p=postrr.git CData: Declared CData_update() as not strict. Any or all arguments may in fact be NULL. This happens, e.g., when updating single CData columns one by one. In this case, use the other argument as return value, i.e. leaving it unmodified. --- diff --git a/src/cdata.c b/src/cdata.c index 26f2656..c4f9340 100644 --- a/src/cdata.c +++ b/src/cdata.c @@ -363,6 +363,9 @@ cdata_update(PG_FUNCTION_ARGS) data = PG_GETARG_CDATA_P(0); update = PG_GETARG_CDATA_P(1); + if (! data) + PG_RETURN_CDATA_P(update); + if ((data->cf != update->cf) && (update->val_num > 1)) ereport(ERROR, ( errcode(ERRCODE_INVALID_PARAMETER_VALUE), diff --git a/src/postrr.sql.in b/src/postrr.sql.in index 68c47df..01cd65f 100644 --- a/src/postrr.sql.in +++ b/src/postrr.sql.in @@ -292,7 +292,7 @@ CREATE CAST (cdata AS double precision) CREATE OR REPLACE FUNCTION CData_update(cdata, cdata) RETURNS cdata AS 'postrr-@POSTRR_MAJOR_VERSION@.@POSTRR_MINOR_VERSION@', 'cdata_update' - LANGUAGE 'C' IMMUTABLE STRICT; + LANGUAGE 'C' IMMUTABLE; COMMIT;