Re: Docs patch to note that rules only get run once per query. - Mailing list pgsql-docs

From Sean Reifschneider
Subject Re: Docs patch to note that rules only get run once per query.
Date
Msg-id 20030414035829.GI7507@tummy.com
Whole thread Raw
In response to Re: Docs patch to note that rules only get run once per query.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Docs patch to note that rules only get run once per query.  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Docs patch to note that rules only get run once per query.  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-docs
On Sun, Apr 13, 2003 at 11:47:32PM -0400, Tom Lane wrote:
>Sean Reifschneider <jafo@tummy.com> writes:
>> I've made the following patch to the current CVS docs.
>
>> +  Note that rules are only invoked once per query.
>
><<itch>> This still seems like a serious oversimplification or
>misexplanation to me.  It's true that a rule creates only one new query
>to execute alongside each user-supplied query --- but that additional
>query can execute upon many individual rows.  So I feel dissatisfied
>with the above "clarification".  Can you think of another way to explain
>it?

Unfortunately, I really don't understand it...  My first thought was
that it was a bug, but when I presented it to the bugs list they said
that the rule only gets executed once per query and that triggers should
be used if you want to run on every impacted row.

Perhaps this re-wording make is more clear?

<Note>
 <Para>
  Note that rules are only invoked once per query.  This may be a problem
  in instances where the rule is updating table A based on table B's
  contents.  If you do a multi-row delete on B, the rule may get run
  only after the delete of the first row, not after all deletes finish.
  In this case, you will have to use a trigger.
 </Para>
</Note>

Sean
--
 *** Quits: TITANIC (Excess Flood)
Sean Reifschneider, Inimitably Superfluous <jafo@tummy.com>
tummy.com, ltd. - Linux Consulting since 1995.  Qmail, Python, SysAdmin
      Back off man. I'm a scientist.   http://HackingSociety.org/


pgsql-docs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Docs patch to note that rules only get run once per query.
Next
From: Tom Lane
Date:
Subject: Re: Docs patch to note that rules only get run once per query.