Skip site navigation (1) Skip section navigation (2)

NULL function arguments?

From: Mark Volpe <volpe(dot)mark(at)epamail(dot)epa(dot)gov>
To: pgsql-sql(at)postgresql(dot)org
Subject: NULL function arguments?
Date: 2000-08-21 17:26:39
Message-ID: 39A1664F.4AFCEF42@epamail.epa.gov (view raw or flat)
Thread:
Lists: pgsql-sql
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

pgsql-sql by date

Next:From: Franz J FortunyDate: 2000-08-21 17:49:40
Subject: Upper case or lower case....
Previous:From: Stephan SzaboDate: 2000-08-21 16:47:12
Subject: Re: Re: Beginner problems with functions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group