Re: creating a function returning FALSE on NULL input ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Yvon Thoraval <yvon(dot)thoraval(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: creating a function returning FALSE on NULL input ?
Date: 2012-11-07 07:24:32
Message-ID: 1110.1352273072@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yvon Thoraval <yvon(dot)thoraval(at)gmail(dot)com> writes:
> CREATE FUNCTION has_infos(text) RETURNS boolean AS 'select
> character_length($1) > 0;' LANGUAGE SQL IMMUTABLE RETURNS FALSE ON NULL
> INPUT;

FWIW, "RETURNS NULL ON NULL INPUT" is a formulaic phrase specified
in the SQL standard. It's not meant to be something you can plug an
arbitrary value into --- it has to be written exactly that way.
The traditional Postgres term is just "STRICT", which means precisely
the same thing.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tianyin Xu 2012-11-07 07:37:39 The bug reporting form are unavailable
Previous Message Yvon Thoraval 2012-11-07 06:51:23 Re: creating a function returning FALSE on NULL input ?