[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    [GENERAL] =?UTF-8?Q?Re=3A_=5BGENERAL=5D_UPDATE_RULE_to_be_invoked_when_UPDATE_?= =?UTF-8?Q?=2E=2E_WH
From:       Pavan Deolasee <pavan.deolasee () gmail ! com>
Date:       2012-08-31 5:51:42
Message-ID: CABOikdPoyuZ0G7RPLYw9ySTXqV6fXL=6hNCw1XKU4yRZBLHgbA () mail ! gmail ! com
[Download RAW message or body]

On Thu, Aug 30, 2012 at 6:31 PM, John Lumby <johnlumby@hotmail.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

[Attachment #3 (text/html)]

<br><br><div class="gmail_quote">On Thu, Aug 30, 2012 at 6:31 PM, John Lumby <span \
dir="ltr">&lt;<a href="mailto:johnlumby@hotmail.com" \
target="_blank">johnlumby@hotmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">

<br>
I would like to use an UPDATE RULE to modify the action performed<br>
when any UPDATE is attempted on a certain table,<br>
*including* an UPDATE which would fail because of no rows matching the WHERE.<br>
<br>
Is this at all possible?    I have tried with variations of ALSO|INSTEAD etc<br>
but the RULE is never invoked in the failing case.      And my reading of<br>
chapter 38.3.1. How Update Rules Work<br>
is that the original query&#39;s quallification is always present.<br>
<br></blockquote><div><br></div><div>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&#39;t see them firing unless there are any qualifying \
rows. Is this not something you can achieve via statement-level triggers though \
?</div>

<div><br></div><div>Thanks,</div><div>Pavan</div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic