Re: [GENERAL] UPDATE RULE to be invoked when UPDATE .. WHERE fails the WHERE predicate ?‏

From: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
To: John Lumby <johnlumby(at)hotmail(dot)com>
Cc: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] UPDATE RULE to be invoked when UPDATE .. WHERE fails the WHERE predicate ?‏
Date: 2012-08-31 05:39:42
Message-ID: CABOikdPoyuZ0G7RPLYw9ySTXqV6fXL=6hNCw1XKU4yRZBLHgbA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Aug 30, 2012 at 6:31 PM, John Lumby <johnlumby(at)hotmail(dot)com> wrote:

>
> I would like to use an UPDATE RULE to modify the action performed
> when any UPDATE is attempted on a certain table,
> *including* an UPDATE which would fail because of no rows matching the
> WHERE.
>
> Is this at all possible? I have tried with variations of ALSO|INSTEAD
> etc
> but the RULE is never invoked in the failing case. And my reading of
> chapter 38.3.1. How Update Rules Work
> is that the original query's quallification is always present.
>
>
You did not mention why you need such a facility, but AFAICS RULEs will
only be applied on the qualifying rows. So as you rightly figured out, you
won't see them firing unless there are any qualifying rows. Is this not
something you can achieve via statement-level triggers though ?

Thanks,
Pavan

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dipti Bharvirkar 2012-08-31 07:47:38 Error stopping postgresql service on a standby server.
Previous Message Craig Ringer 2012-08-31 01:37:05 Re: psql & unix env variables