Re: update in rule
От | Stephan Szabo |
---|---|
Тема | Re: update in rule |
Дата | |
Msg-id | 20011107090403.K49204-100000@megazone23.bigpanda.com обсуждение исходный текст |
Ответ на | Re: update in rule (Radoslaw Stachowiak <radek@alter.pl>) |
Список | pgsql-admin |
On Wed, 7 Nov 2001, Radoslaw Stachowiak wrote: > *** Stephan Szabo <sszabo@megazone23.bigpanda.com> [Wednesday, 17.October.2001, 12:04 -0700]: > > create function adresses_trigger() returns opaque as ' > > begin > > NEW.date_maj := now(); > > return NEW; > > end;' language 'plpgsql'; > > create trigger tr before update on adresses for each row execute > > procedure adresses_trigger(); > > why sould I use before (instead of after)? > isnt it a little dangerous in transactions? /hope not/ > > I know difference between both forms. The question is rather about if > timestamp updating shouldnt be run AFTER update which I think is closer > to a real world situations (of course evth vary). But maybe there are > some probles with after, which I dont know about? It's pretty much 6 of one, half dozen of another AFAICS. This doesn't actually update the table per-se, it updates the copy of the row that you've asked to update the row to. The actual update changes the date column.
В списке pgsql-admin по дате отправления: