All function parameters become NULL if one is?

Поиск
Список
Период
Сортировка
От Joel Burton
Тема All function parameters become NULL if one is?
Дата
Msg-id 200009162247.e8GMlan28506@olympus.scw.org
обсуждение исходный текст
Ответы Re: [GENERAL] All function parameters become NULL if one is?
Список 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@scw.org
Support Center of Washington (www.scw.org)

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: installing pgaccess
Следующее
От: Philip Warner
Дата:
Сообщение: Does optimizer know about 'constant' expressions?