Re: passing values to a function

Поиск
Список
Период
Сортировка
От Cedar Cox
Тема Re: passing values to a function
Дата
Msg-id Pine.LNX.4.21.0102200003440.31428-100000@nanu.visionforisrael.com
обсуждение исходный текст
Ответ на Re: passing values to a function  (Jan Wieck <janwieck@Yahoo.com>)
Ответы Re: passing values to a function  (Jan Wieck <janwieck@Yahoo.com>)
Список 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 по дате отправления:

Предыдущее
От: Jan Wieck
Дата:
Сообщение: Re: passing values to a function
Следующее
От: Tom Lane
Дата:
Сообщение: Unportable code in odbc's dlg_specific.h