fail-safe sql update triggers

Поиск
Список
Период
Сортировка
От Michael Monnerie
Тема fail-safe sql update triggers
Дата
Msg-id vmime.4c80f217.42d2.c43fd4a13aa09607@zarafa14.zmi.at
обсуждение исходный текст
Ответы Re: fail-safe sql update triggers  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Re: fail-safe sql update triggers  ("Rob Richardson" <Rob.Richardson@rad-con.com>)
Re: fail-safe sql update triggers  ("Igor Neyman" <ineyman@perceptron.com>)
Список pgsql-admin
I want to log all activity from a table to a old_table. Creating an ON INSERT trigger is simple, it just needs to

INSERT INTO old_filter SELECT NEW.*;

in a procedure that is called via the trigger. But what about updates? There is no simple

UPDATE old_filter SET NEW.* WHERE id=NEW.id;

so I would need to declare each column like

UPDATE old_filter SET field1=NEW.field1,f2=NEW.f2,.... where id=NEW.id;

But that is error prone, because when the "filter" table is changed to have a new column, the UPDATE statement would
notcontain it. Is there a fail-proof shortcut? 


mit freundlichen Grüßen
Michael Monnerie, Ing. BSc

it-management Internet Services
http://proteger.at [gesprochen: Prot-e-schee]
Tel: 0660 / 415 65 31

// Wir haben im Moment zwei Häuser zu verkaufen:
// http://zmi.at/langegg/
// http://zmi.at/haus2009/




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

Предыдущее
От: Ireneusz Pluta
Дата:
Сообщение: Re: Autovacuum and invalid page header
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: fail-safe sql update triggers