Re: IS NULL seems to return false, even when parameter is NULL

Поиск
Список
Период
Сортировка
От Andrus
Тема Re: IS NULL seems to return false, even when parameter is NULL
Дата
Msg-id 9F9CF36A18A14D05BB4E048F2EDFB515@andrusnotebook
обсуждение исходный текст
Ответ на IS NULL seems to return false, even when parameter is NULL  (Lucazeo <lucazeo@katamail.com>)
Ответы Re: IS NULL seems to return false, even when parameter is NULL  (Richard Huxton <dev@archonet.com>)
Re: IS NULL seems to return false, even when parameter is NULL  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
>I have a strange problem with the following condition in a SELECT:
> AND (("TableData" = "inDate") OR ("inDate" IS NULL))
>
> it works perfectly when the input date in the function (inDate) matchs
> a date in the table, but it does not work when the parameter inDate is
> NULL.
> I recall the function with pgadmin writing NULL as paramater.
> It seems that ("inDate" IS NULL) never returns true, even when the
> parameter is null...
> What's wrong?

Order is wrong, change it to

> AND (("inDate" IS NULL) OR ("TableData" = "inDate") )

PostgreSQL OR is not commutative if left operand evaluates to NULL.

Andrus.


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

Предыдущее
От: "Philip W. Dalrymple"
Дата:
Сообщение: Session variables (how do I pass session data to a function)
Следующее
От: "Harald Armin Massa"
Дата:
Сообщение: Re: Session variables (how do I pass session data to a function)