Re: ISSTRICT behavior

From: Don Y <pgsql(at)DakotaCom(dot)Net>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: ISSTRICT behavior
Date: 2006-05-04 07:50:00
Message-ID: 4459B228.2080309@DakotaCom.Net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout wrote:
> On Thu, May 04, 2006 at 12:29:30AM -0700, Don Y wrote:
>> OTOH, if the function could *abort* it's invocation, then
>> I don't have to worry about return values. It is a closer
>> model to the STRICT behavior -- instead of aborting the
>> function invocation BEFORE (which STRICT essentially does),
>> I could abort it AFTER invocation (once I had detected
>> the NULL argument)
>
> Are you sure you understand what STRICT does? STRICT doesn't abort
> anything. STRICT means "if this function gets called with any NULL
> arguments, the result is NULL". Since this is correct behaviour for the
> vast majority of functions, it's implemented as a flag rather than
> requiring each and every function to check.

Ah, I have misunderstood this! I saw it as "if invoked with NULL,
don't invoke the function" -- which, I guess, is somewhat consistent
with your comment... the function isn't invoked, BUT 'NULL' IS
SUBSTITUTED FOR IT'S RETURN VALUE.

> Also, anything that calls a function must be prepared to handle a NULL
> return value. Any function can return NULL, even if only because it is
> declared strict and you passed a null argument...

So, even the functions that I am defining that ALWAYS return
particular types have to be treated AS IF they could return NULL?
(in the case you describe -- the opposite case that I have been
describing)

Hmmm... that might make things even easier!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Don Y 2006-05-04 07:54:09 Re: ISSTRICT behavior
Previous Message Don Y 2006-05-04 07:43:58 Re: ISSTRICT behavior