Re: creating a function returning FALSE on NULL input ?

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: creating a function returning FALSE on NULL input ?
Дата
Msg-id 1617B66F-C96C-413A-9ECF-89379776130F@gmail.com
обсуждение исходный текст
Ответ на creating a function returning FALSE on NULL input ?  (Yvon Thoraval <yvon.thoraval@gmail.com>)
Ответы Re: creating a function returning FALSE on NULL input ?  (Yvon Thoraval <yvon.thoraval@gmail.com>)
Список pgsql-general
On 7 Nov 2012, at 6:33, Yvon Thoraval wrote:

> CREATE FUNCTION has_infos(text) RETURNS boolean AS 'select character_length($1) > 0;' LANGUAGE SQL IMMUTABLE RETURNS
FALSEON NULL INPUT; 

Try:
CREATE FUNCTION has_infos(text) RETURNS boolean AS 'select coalesce(character_length($1) > 0, false);' LANGUAGE SQL
IMMUTABLE;

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.



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

Предыдущее
От: Tianyin Xu
Дата:
Сообщение: The bug reporting form are unavailable
Следующее
От: Yvon Thoraval
Дата:
Сообщение: Re: creating a function returning FALSE on NULL input ?