Re: RULES

Поиск
Список
Период
Сортировка
От Ross J. Reedstrom
Тема Re: RULES
Дата
Msg-id 20010522095355.E18984@rice.edu
обсуждение исходный текст
Ответ на Re: RULES  (Martín Marqués <martin@bugs.unl.edu.ar>)
Список pgsql-sql
On Tue, May 22, 2001 at 10:44:06AM +0300, Mart?n Marqu?s wrote:
> On Mar 22 May 2001 20:19, J.Fernando Moyano wrote:
> > Deleting is broken if it deletes more than one row. The rule is executed
> > only one time each delete command, and not one time each deleted row.
> >
> > It's this OK ??? Am i wrong ???
> > It's a "feature" ??  ;-)
> 
> That's the right behaviour!
> Each time you do a delete, besides the delete, it will execute the update....
> If more then one row is deletes, update.... gets executed only once.
> 

Rules are rewrites of the SQL query, before it gets planned and
optimized, so they are good for things that need to happen once per
statement. Triggers, on the other hand, fire per tuple, when the actual
bits are going into/out of the underlying table. They're good for things
that need to happen per tuple.  

See Bruce's book for the basics:

http://www.ca.postgresql.org/docs/aw_pgsql_book/node166.html

Ross


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

Предыдущее
От: "Mikheev, Vadim"
Дата:
Сообщение: RE: [HACKERS] Re: possible row locking bug in 7.0.3 & 7.1
Следующее
От: Najm Hashmi
Дата:
Сообщение: Re: Calculating the age of a person