Re: [HACKERS] NULL as an argument in plpgsql functions

From: "D'Arcy" "J(dot)M(dot)" Cain <darcy(at)druid(dot)net>
To: lockhart(at)alumni(dot)caltech(dot)edu (Thomas Lockhart)
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] NULL as an argument in plpgsql functions
Date: 1999-10-03 08:54:38
Message-ID: m11XhPi-0000e5C@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thus spake Thomas Lockhart
> Another side issue; any function called with a null parameter will
> actually not get called at all! Postgres assumes that a function
> called with null must return null, so doesn't bother calling the
> routine...

Did this get changed recently? AFAIK the routine gets called. It's just
that the result is ignored and null is then returned. This bit me in the
ass when I was working on the inet stuff. If I didn't check for NULL and
return something my function would dump core but if I tried to deal with
the NULL and return something sensible, the function returned NULL anyway.

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?

--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-10-03 16:32:46 Re: [HACKERS] NULL as an argument in plpgsql functions
Previous Message Thomas Lockhart 1999-10-03 06:14:15 Re: [HACKERS] NULL as an argument in plpgsql functions