All function parameters become NULL if one is?

From: "Joel Burton" <jburton(at)scw(dot)org>
To: pgsql-general(at)postgreSQL(dot)org, pgsql-sql(at)postgreSQL(dot)org
Subject: All function parameters become NULL if one is?
Date: 2000-09-16 22:47:35
Message-ID: 200009162247.e8GMlan28506@olympus.scw.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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(at)scw(dot)org
Support Center of Washington (www.scw.org)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ross J. Reedstrom 2000-09-17 03:45:34 Re: 7.0.2 and 6.5.3 performance
Previous Message Dave Hollenbeck 2000-09-16 22:08:46 arrays and subselects

Browse pgsql-sql by date

  From Date Subject
Next Message Philip Warner 2000-09-17 08:43:19 Does optimizer know about 'constant' expressions?
Previous Message Tom Lane 2000-09-16 05:49:27 Re: installing pgaccess