All function parameters become NULL if one is? - Mailing list pgsql-sql

From Joel Burton
Subject All function parameters become NULL if one is?
Date
Msg-id 200009162247.e8GMlan28506@olympus.scw.org
Whole thread Raw
Responses Re: [GENERAL] All function parameters become NULL if one is?
List pgsql-sql
I have a function that takes two text parameters. If both of these
are non-null, everything works fine. However, if one of these two
parameters is null and one is not, the function receives both as null.

CREATE FUNCTION F(TEXT,TEXT) RETURNS TEXT AS '
BEGIN
  RETURN $2;
END;
' LANGUAGE 'plpgsql';

SELECT F(null,'Hello');

returns null.

Is this intentional? Is there a way around this?
--
Joel Burton, Director of Information Systems -*- jburton@scw.org
Support Center of Washington (www.scw.org)

pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: installing pgaccess
Next
From: Philip Warner
Date:
Subject: Does optimizer know about 'constant' expressions?