Skip site navigation (1) Skip section navigation (2)

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

From: Sean Reifschneider <jafo(at)tummy(dot)com>
To: pgsql-docs(at)postgresql(dot)org
Subject: Docs patch to note that rules only get run once per query.
Date: 2003-04-13 23:43:49
Message-ID: 20030413234349.GF7507@tummy.com (view raw or flat)
Thread:
Lists: 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(at)tummy(dot)com>
tummy.com, ltd. - Linux Consulting since 1995.  Qmail, Python, SysAdmin


Responses

pgsql-docs by date

Next:From: Tom LaneDate: 2003-04-14 03:47:32
Subject: Re: Docs patch to note that rules only get run once per query.
Previous:From: Tom LaneDate: 2003-04-12 04:16:18
Subject: Re: 6.8.5: Location of CURRENT_DATE unclear

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group