I have a function that updates a row:
CREATE OR REPLACE FUNCTION MyTable_UPDATE
(
_ID int,
_Description text
)
RETURNS bool
AS $$
DECLARE _OK boolean;
BEGIN
_OK := false;
UPDATE mytable SET
Description = _Description
WHERE ID = _ID;
_OK := true;
RETURN _OK;
END;
$$ LANGUAGE plpgsql STRICT;
When I call it with a value in description it works:
select MyTable_UPDATE(9, 'testing 123');
If I call it with a null value, it doesn't update, there is no error message and no value is returned:
select MyTable_UPDATE(9, null);
If I run an update query to set description = null, it works:
UPDATE mytable SET
Description = null
WHERE ID = 9;