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

Поиск
Список
Период
Сортировка
От D'Arcy" "J.M." Cain
Тема Re: [HACKERS] NULL as an argument in plpgsql functions
Дата
Msg-id m11XhPi-0000e5C@druid.net
обсуждение исходный текст
Ответ на Re: [HACKERS] NULL as an argument in plpgsql functions  (Thomas Lockhart <lockhart@alumni.caltech.edu>)
Ответы Re: [HACKERS] NULL as an argument in plpgsql functions
Re: [HACKERS] NULL as an argument in plpgsql functions
Список 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@{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.


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: [HACKERS] NULL as an argument in plpgsql functions
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: [HACKERS] Tricky query, tricky response