Re: Problem with rule and null value

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Problem with rule and null value
Дата
Msg-id 20065.1098486444@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Problem with rule and null value  (Marc Boucher <pgml@gmx.net>)
Список pgsql-bugs
Marc Boucher <pgml@gmx.net> writes:
> CREATE OR REPLACE RULE albed_updalb3_rl AS
>    ON UPDATE TO album WHERE new.pls_id != old.pls_id
>   DO
>    UPDATE album_edit SET pls_id=new.pls_id WHERE alb_id=new.id;

> It works until new.pls_id or old.pls_id is null. The rule is still called
> (based on my test), but the "DO" query is not executed correctly.

That's not a bug.  "foo != NULL" does not yield true, it yields NULL.
You could test for nulls with IS NULL, or possibly use the IS DISTINCT
FROM construct (does 7.3 have that?  I forget.)

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: AT TIME ZONE INTERVAL and prepared statements
Следующее
От: H Chao
Дата:
Сообщение: select() failed in statistics collector