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

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Docs patch to note that rules only get run once per query.
Дата
Msg-id Pine.LNX.4.44.0304141449470.1919-100000@peter.localdomain
обсуждение исходный текст
Ответ на Re: Docs patch to note that rules only get run once per query.  (Sean Reifschneider <jafo@tummy.com>)
Ответы Re: Docs patch to note that rules only get run once per query.  (Sean Reifschneider <jafo@tummy.com>)
Список pgsql-docs
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   peter_e@gmx.net


В списке pgsql-docs по дате отправления:

Предыдущее
От: Curt Sampson
Дата:
Сообщение: Re: 6.8.5: Location of CURRENT_DATE unclear
Следующее
От: Sean Reifschneider
Дата:
Сообщение: Re: Docs patch to note that rules only get run once per query.