Re: passing values to a function - Mailing list pgsql-interfaces

From Cedar Cox
Subject Re: passing values to a function
Date
Msg-id Pine.LNX.4.21.0102200003440.31428-100000@nanu.visionforisrael.com
Whole thread Raw
In response to Re: passing values to a function  (Jan Wieck <janwieck@Yahoo.com>)
Responses Re: passing values to a function  (Jan Wieck <janwieck@Yahoo.com>)
List pgsql-interfaces
> > Why does this not work?  Am I doing something wrong?
..
> >   raise notice '' varop is '',varop;
> 
>     raise notice '' varop is %'', varop;

Arrrg!  How did I miss that one.. I've been writing notice lines for
months now!

Ok, well I seem to have found the "real" problem this time ;)

CREATE FUNCTION update_sentitems(text,int4) RETURNS bool AS '
declare varop alias for $1;
begin raise notice '' varop = %'',varop; return false;
end;
' LANGUAGE 'plpgsql';

Giving select update_sentitems('INSERT',1);
returns NOTICE:   varop = INSERT
as expected, however if you give select update_sentitems('INSERT',null);
this is returned: NOTICE:   varop = <NULL>

BTW, it doesn't matter if both parameters are text or int4.  Also, it
doesn't matter which one is given as null, they both turn up null.  
Bottom line seems to be that if you call the function with any parameter
null, they are all null.  Sooo.. what's up here?  Is this a bug that's
been fixed in 7.0.3? (I'm still using 7.0.2).

Thanks
-Cedar



pgsql-interfaces by date:

Previous
From: Jan Wieck
Date:
Subject: Re: passing values to a function
Next
From: Tom Lane
Date:
Subject: Unportable code in odbc's dlg_specific.h