Hello
I wrote a plpgsql function with few parameters ; when I call the function,
some of the parameters can be null.
In this case, all the parameters are considered as null in the function's
body ! is it a feature ? how can I work around this ?
Example :
CREATE FUNCTION foo(text, text) RETURNS bool AS '
begin
IF ($1 IS NULL) AND ($2 IS NULL) THEN
RETURN FALSE;
ELSE
RETURN TRUE;
END IF;
end;
' LANGUAGE 'plpgsql';
SELECT foo(null,'bouh') => false (I expected true)
SELECT foo('schfk',null) => false (I expected true)
SELECT foo(null,null) => false (OK)
SELECT foo('schfk','bouh') => true (OK)