passing null parameter to plpgsq functions

Поиск
Список
Период
Сортировка
От Picard, Cyril
Тема passing null parameter to plpgsq functions
Дата
Msg-id B5CDCF382265D311BF33009027A8FE9401E6F365@pmrmsg.edsn.com
обсуждение исходный текст
Список pgsql-sql
Hello 
I wrote a plpgsql function with few parameters ; when I call the function,
some of the parameters can be null.
In this case, all the parameters are considered as null in the function's
body ! is it a feature ? how can I work around this ?

Example :
CREATE FUNCTION foo(text, text) RETURNS bool  AS '
beginIF ($1 IS NULL) AND ($2 IS NULL) THEN     RETURN FALSE;ELSE     RETURN TRUE;END IF;
end;
' LANGUAGE 'plpgsql';


SELECT foo(null,'bouh') => false (I expected true)
SELECT foo('schfk',null) => false (I expected true)
SELECT foo(null,null) => false (OK)
SELECT foo('schfk','bouh') => true (OK)





В списке pgsql-sql по дате отправления:

Предыдущее
От: "Gerald Gutierrez"
Дата:
Сообщение: Appropriate indices to create for these queries
Следующее
От: "Richard Huxton"
Дата:
Сообщение: Re: Appropriate indices to create for these queries