Re: [SQL] nulls and datetime

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] nulls and datetime
Дата
Msg-id 18520.942680505@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [SQL] nulls and datetime  (Thomas Lockhart <lockhart@alumni.caltech.edu>)
Список pgsql-sql
Thomas Lockhart <lockhart@alumni.caltech.edu> writes:
> In previous versions, single-argument functions with NULL input were
> short-circuited in fmgr (??) and never actually were called.

As long as I've been paying attention (which is only since 6.4 or so),
execQual+fmgr will call the function regardless of the NULL status of
the inputs.  But the NULL flag for the output is taken to be the OR of
the input NULL flags --- so you can't return anything but NULL for a
NULL input, yet the function code is run anyway.

(Actually, a single-argument function is passed the isNull pointer as
an undocumented second argument, so it's possible for such a function
to clear isNull and thus return non-NULL for NULL input.  ISNULL and
ISNOTNULL work that way, but I haven't seen anything else that uses it.)

This is an incredibly ugly set of kluges, of course, and I'm hoping
to get it cleaned up for 7.0.  See my past memos to pg-hackers on fmgr
redesign.

> Seems to me that NULL in should produce NULL out, which was the old
> behavior. I'll add this to my ToDo, unless someone else has already
> picked it up.

If you don't fix it sooner, I will change it when I pass through that
code doing the fmgr interface changes...
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [SQL] how can tell if a column is a primary key?
Следующее
От: Thomas Lockhart
Дата:
Сообщение: Re: [SQL] nulls and datetime