creating a function returning FALSE on NULL input ?

Поиск
Список
Период
Сортировка
От Yvon Thoraval
Тема creating a function returning FALSE on NULL input ?
Дата
Msg-id CAG6bkBzTAnE1bWS8ChwJFbNtKb7vzkXTB0Ey2QB5p0gg=dsp3w@mail.gmail.com
обсуждение исходный текст
Ответы Re: creating a function returning FALSE on NULL input ?  (David Johnston <polobo@yahoo.com>)
Re: creating a function returning FALSE on NULL input ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: creating a function returning FALSE on NULL input ?  (Alban Hertroys <haramrae@gmail.com>)
Список pgsql-general
I'd like to create a function :
returning true if the length of the text arg is greater than 0 ;
false otherwise ;

and also returning false when arg is NULL, then i wrote :

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

where i get the error :

ERROR:  syntax error at or near "FALSE"
LINE 1: ...r_length($1) > 0;' LANGUAGE SQL IMMUTABLE RETURNS FALSE ON N...

with "RETURNS NULL on NULL INPUT", that's OK.

--
Yvon


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

Предыдущее
От: Bryan Montgomery
Дата:
Сообщение: Re: Tuning / performance questions
Следующее
От: David Johnston
Дата:
Сообщение: Re: creating a function returning FALSE on NULL input ?