From ec00d193ed161a58be46f62fed81adfc5612cfde Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Tue, 23 Oct 2012 12:49:11 +0200 Subject: [PATCH] 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. --- src/cdata.c | 3 +++ src/postrr.sql.in | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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; -- 2.30.2