Re: Docs patch to note that rules only get run once per query.

From: Sean Reifschneider <jafo(at)tummy(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-docs(at)postgresql(dot)org
Subject: Re: Docs patch to note that rules only get run once per query.
Date: 2003-04-14 03:58:29
Message-ID: 20030414035829.GI7507@tummy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Sun, Apr 13, 2003 at 11:47:32PM -0400, Tom Lane wrote:
>Sean Reifschneider <jafo(at)tummy(dot)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(at)tummy(dot)com>
tummy.com, ltd. - Linux Consulting since 1995. Qmail, Python, SysAdmin
Back off man. I'm a scientist. http://HackingSociety.org/

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2003-04-14 04:11:55 Re: Docs patch to note that rules only get run once per query.
Previous Message Tom Lane 2003-04-14 03:47:32 Re: Docs patch to note that rules only get run once per query.