Re: need help to write a function in postgresql

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: need help to write a function in postgresql
Дата
Msg-id 501B905E.1050706@ringerc.id.au
обсуждение исходный текст
Ответ на Re: need help to write a function in postgresql  (Laszlo Nagy <gandalf@shopzeus.com>)
Список pgsql-admin
On 08/03/2012 04:37 PM, Laszlo Nagy wrote:
> It is also better because with a view, you can also do " name is null
> ". But you cannot do that with a function (unless you write
> unnecessary circumstancial code.)
>
While I agree with you on the view - among other things, it lets the
query optimiser push conditions down into the view query - there is a
reasonable answer to the problem of comparing to NULL. Just use IS
DISTINCT FROM, eg:

    WHERE name IS DISTINCT FROM _test_variable

"IS DISTINCT FROM" is an equality comparison that treats null as a
comparable value like any other, so "NULL IS DISTINCT FROM NULL" is
false. Very handy.

--
Craig Ringer

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

Предыдущее
От: Laszlo Nagy
Дата:
Сообщение: Re: need help to write a function in postgresql
Следующее
От: JC de Villa
Дата:
Сообщение: Re: Messed up time zones