I wrote a function in PL/pgSQL that can accept NULL input values in some
variables. But I found that if I pass a single NULL value to the function,
all other values become NULL too. Here is the example:
CREATE FUNCTION fn_test(INT4, NUMERIC)
RETURNS NUMERIC AS '
BEGIN
RAISE NOTICE
''%, %'', $1, $2;
RETURN $2;
END;
' LANGUAGE 'plpgsql';
peroon#= SELECT fn_test(1, 2.00);
NOTICE: 1, 2.000000
fn_test
---------
2
(1 row)
peroon#= SELECT fn_test(1, NULL);
NOTICE: <NULL>, <NULL>
fn_test
---------
(1 row)
Is it a bug?
I found no notice about it in documentation, so one more question:
Is there any workaround?
Alex Bolenok.