public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: Sean Reifschneider <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: [email protected]
Subject: Re: Docs patch to note that rules only get run once per query.
Date: Mon, 14 Apr 2003 18:38:16 +0200 (CEST)
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Sean Reifschneider writes:

> <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>

This can't possibly be true.  Rules are never invoked "after" any deletion
of any row.  Take a close look at the examples of update rules in the
documentation.  Read how the references to NEW and OLD are resolved.
Play out the expansion of your example of paper.

The rule will expand your initial command to a big and ugly set of
commands.  But all those commands are applied like any normal command that
you could have entered by hand.  So if too few or too many rows are
affected, that's because of the conditions attached to the command.

-- 
Peter Eisentraut   [email protected]




view thread (7+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Docs patch to note that rules only get run once per query.
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox