Re: Implementing a change log

Поиск
Список
Период
Сортировка
От Mike Rylander
Тема Re: Implementing a change log
Дата
Msg-id b918cf3d050920050029d8149e@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Implementing a change log  (Berend Tober <btober@seaworthysys.com>)
Ответы Re: Implementing a change log  (Berend Tober <btober@seaworthysys.com>)
Список pgsql-general
On 9/20/05, Berend Tober <btober@seaworthysys.com> wrote:
> /*
> The following is based on suggestion by Mike Rylander posted on
> Postgresql-General
> Sun, 18 Sep 2005 23:29:51 +0000
>
> Rylander's original suggestion employed a trigger and tracked
> only row updates. My implementation makes use of rules and
> handles both updates and deletions.
> */

I'm glad that was inspirational for you.  Not to nit pick, but my
trigger based version did in fact track deletions:

CREATE TRIGGER audit_$$ || sch || $$_$$ || tbl || $$_update_trigger
    AFTER UPDATE OR DELETE ON $$ || sch || $$.$$ || tbl || $$ FOR EACH ROW
              ^^^^^^^
    EXECUTE PROCEDURE auditor.audit_$$ || sch || $$_$$ || tbl || $$_func ();

You may want to consider using the LIKE style of table copying, as it
strips all constraints from the new table.  It's safer IMHO, as this
way you wouldn't have to worry about the primary key being propagated
to the new table (and accidentally forgetting to remove it).

--
Mike Rylander
mrylander@gmail.com
GPLS -- PINES Development
Database Developer
http://open-ils.org

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

Предыдущее
От: Daniel Schuchardt
Дата:
Сообщение: Re: shared Locks
Следующее
От: "Belinda M. Giardine"
Дата:
Сообщение: running vacuum in scripts