Re: Updatable view does not work [oops, quite long!] - Mailing list pgsql-novice

From Manfred Koizar
Subject Re: Updatable view does not work [oops, quite long!]
Date
Msg-id np0udvsg9reogeil6740qc40cd8hsa7d3j@4ax.com
Whole thread Raw
In response to Updatable view does not work [oops, quite long!]  (Thiemo Kellner <thiemo@thiam.ch>)
Responses Re: Updatable view does not work [oops, quite long!]
List pgsql-novice
On Wed, 04 Jun 2003 22:54:34 +0200, Thiemo Kellner <thiemo@thiam.ch>
wrote:
>CREATE RULE ru_v_passwort_del
>    AS ON DELETE TO passwort
>       DO INSTEAD
>          DELETE FROM pwd
>       WHERE (
>                 [...]
>                 (pwd.link = old.link)
> [...]

This will not evaluate to true, if old.link is null.  Remember that
    NULL = NULL
is neither true nor false, but unknown.  And
    true AND unknown
is still unknown.

You need somethink bulky like
    pwd.link = old.link OR (pwd.link IS NULL AND old.link IS NULL)

or you include the primary key into your view and use
    pwd.pk = old.pk
in the rule.

Servus
 Manfred

pgsql-novice by date:

Previous
From: Nabil Sayegh
Date:
Subject: Re: 7.2 -> 7.3 timespan, interval etc.
Next
From: Thiemo Kellner
Date:
Subject: Re: Updatable view does not work [oops, quite long!]