Search Postgresql Archives

Re: creating a function returning FALSE on NULL input ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fine, thanks it's shorter than mine and works too.
I'll adopt it ))



2012/11/7 Alban Hertroys <haramrae@xxxxxxxxx>
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 FALSE ON 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.




--
Yvon



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux