Re: Updatable view does not work [oops, quite long!]

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: Thiemo Kellner <thiemo(at)thiam(dot)ch>
Cc: pgNovice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Updatable view does not work [oops, quite long!]
Date: 2003-06-05 09:18:13
Message-ID: np0udvsg9reogeil6740qc40cd8hsa7d3j@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, 04 Jun 2003 22:54:34 +0200, Thiemo Kellner <thiemo(at)thiam(dot)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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Nabil Sayegh 2003-06-05 11:08:49 Re: 7.2 -> 7.3 timespan, interval etc.
Previous Message Thiemo Kellner 2003-06-05 08:03:23 Re: Updatable view does not work [oops, quite long!]