Re: isnull

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: isnull
Дата
Msg-id 28671.954461509@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: isnull  (Joseph Shraibman <jks@p1.selectacast.net>)
Список pgsql-sql
Joseph Shraibman <jks@p1.selectacast.net> writes:
> Ah, I think the documentation that came with 6.5.3 was wrong, because
> http://www.postgresql.org/docs/postgres/functions.htm#AEN2257 has the
> function nullif where ifnull was in my documentation.  I don't get
> errors now, but it just doesn't seem to do it's job.

NULLIF doesn't do what you seem to expect: it is for *creating* nulls,
not removing them.  It produces a null if the two arguments are equal,
else the first argument.

COALESCE is probably the thing you are after: it produces the first
nonnull value among its arguments, reading left to right.

There isn't anything called IFNULL in the SQL92 spec, though there
is an IS NULL test (note space).

No, I didn't choose these names ;-) ... blame the SQL92 authors ...
        regards, tom lane


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

Предыдущее
От: Joseph Shraibman
Дата:
Сообщение: Re: isnull
Следующее
От: Julie Hunt
Дата:
Сообщение: Re: isnull