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

From Sean Reifschneider
Subject Docs patch to note that rules only get run once per query.
Date
Msg-id 20030413234349.GF7507@tummy.com
Whole thread Raw
Responses Re: Docs patch to note that rules only get run once per query.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-docs
I've made the following patch to the current CVS docs.  This is to
explain some confusion I ran into when trying to use rules.  After
reading the documentation on rules, I was expecting my rule to get run
at the end of a query where I deleted multiple rows, not after the first
row was deleted, then not any further.

I think the below text makes it more clear that this may happen and is
not a bug.

Sean

--- rules.sgml.old    2003-04-13 16:58:27.000000000 -0600
+++ rules.sgml    2003-04-13 17:26:53.000000000 -0600
@@ -32,6 +32,15 @@
      linkend="ONG90">.
 </para>

+<Note>
+ <Para>
+  Note that rules are only invoked once per query.  This may be a problem
+  in instances where the rule is updating a table based on another table's
+  contents, and you do a delete or update that changes multiple rows.  In
+  this case, you will have to use a trigger.
+ </Para>
+</Note>
+
 <Sect1 id="querytree">
 <Title>The Query Tree</Title>

--
 Do one thing every day that scares you.
                 -- Mary Schmich
Sean Reifschneider, Inimitably Superfluous <jafo@tummy.com>
tummy.com, ltd. - Linux Consulting since 1995.  Qmail, Python, SysAdmin


pgsql-docs by date:

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