questions on rules

Поиск
Список
Период
Сортировка
От Timothy Perrigo
Тема questions on rules
Дата
Msg-id A0BC8174-97B5-11D8-B674-000A95C4F0A2@wernervas.com
обсуждение исходный текст
Ответы Re: questions on rules  (Richard Huxton <dev@archonet.com>)
Re: questions on rules  (Eric Ridge <ebr@tcdi.com>)
Список pgsql-general
I'm trying to set up some basic rules to log inserts, updates, and
deletes to tables in an inheritance hierarchy (by inserting records
into a log table), and I've got a couple of questions.

(1)  Is it possible to create a rule on a base table and have it
operate for all derived tables?  I'd like to just create 3 rules
(insert/update/delete) on the base table and have them apply to all
inherited tables.  Can this be done?

(2) I've got a very simple update rule-- create rule log_updates as on
update to foo do insert into audit_log(table_oid, id, log_what) values
(foo.tableoid, NEW.foo_id, 'U');  I had hoped that this would create a
single entry in my audit_log table for each row updated.  However, it
seems to fire for each record in the "foo" table, even if the update
affected only one row!  What am I doing wrong?

Any help would be very much appreciated.  Thanks!

Tim Perrigo



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

Предыдущее
От: Doug McNaught
Дата:
Сообщение: Re: Help on "unexpected EOF..client reset by peer" errors
Следующее
От: Philipp Buehler
Дата:
Сообщение: Re: 7.3.4 on Linux: UPDATE .. foo=foo+1 degrades massivly