Re: Touch row ?
От | Chris Travers |
---|---|
Тема | Re: Touch row ? |
Дата | |
Msg-id | 016c01c3e23c$069f6390$97285e3d@winxp обсуждение исходный текст |
Ответ на | Re: Upcoming events (Bruce Momjian <pgman@candle.pha.pa.us>) |
Ответы |
Re: Touch row ?
|
Список | pgsql-general |
I too have also noticed that the rule is a really cool way to write lightweight triggers. They are also simpler to use, and often perform better. You can also make them conditional which you cannot do with triggers at the moment. I think this timestamp concept is a perfect example of where a rule is better. It doesn't have to be done on a view either. For example: CREATE TABLE mytable ( my_id SERIAL PRIMARY KEY, last_updated TIMESTAMP); CREATE RULE touch_row AS ON UPDATE TO mytable DO (UPDATE mytable SET last_updated = NOW() WHERE my_id = NEW.my_id); I assume that if you have extremely complex business logic in your triggers, triggers might be better because they are executed in a defined order. But for something like this, I fail to see how it makes things easier rather than harder. Best Wishes, Chris Travers
В списке pgsql-general по дате отправления: