Re: [HACKERS] NULL as an argument in plpgsql functions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] NULL as an argument in plpgsql functions
Date
Msg-id 20815.938968909@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] NULL as an argument in plpgsql functions  ("D'Arcy" "J.M." Cain <darcy@druid.net>)
List pgsql-hackers
"D'Arcy" "J.M." Cain <darcy@druid.net> writes:
> There was a discussion at the time about fixing this so that the function
> never got called as investigation showed that there were existing ones
> that would also crash if given null inputs.  Did this ever happen?

Nothing's changed yet, but you are right that one of the many problems
with the existing fmgr interface is that checking for null inputs is
both necessary and tedious (= frequently omitted).

I have a rough proposal on the table for cleaning this up so that null
handling is done properly, ie, a function can see *which* of its inputs
are null and can choose whether to return null or not.  The most common
case of a "strict" function (any null input -> null result) would be
painless, but we wouldn't force all functions into that straitjacket.
See my pghackers message of 14 Jun 99.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] NULL as an argument in plpgsql functions
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Tricky query, tricky response