Thread: NULL function arguments?

NULL function arguments?

From
Mark Volpe
Date:
It seems that why I provide a NULL argument to a PL/pgSQL function
it makes the rest of the arguments NULL, too!

Consider this function:

CREATE FUNCTION callme(text, text) RETURNS boolean AS
'BEGIN    RAISE NOTICE ''$1: %'', $1;    RAISE NOTICE ''$2: %'', $2;    RETURN TRUE;END;
' LANGUAGE 'plpgsql';

So that when I try SELECT callme('hello', 'world');
I get back:

NOTICE:  $1: hello
NOTICE:  $2: world

But when I do SELECT callme('hello', NULL);
I get back:

NOTICE:  $1: <NULL>
NOTICE:  $2: <NULL>

I'm using Postgres 7.0. Possible bug?

Mark