Adding audit trail fields and triggers to all tables - Mailing list pgsql-general

From Andrus
Subject Adding audit trail fields and triggers to all tables
Date
Msg-id eqveip$1f7f$1@news.hub.org
Whole thread Raw
Responses Re: Adding audit trail fields and triggers to all tables  (David Fetter <david@fetter.org>)
List pgsql-general
I need to add the following fields to all tables to existing 8.1 database:


created timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,

createdby text DEFAULT CURRENT_USER,

updated timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,

updatedby text   -- current_user who last updates this record


I need also to add triggers so that updated and updatedby fields ae
automatically set when record is changed.


Where to find script which implements this ?


Andrus.






pgsql-general by date:

Previous
From: rloefgren@forethought.net
Date:
Subject: Re: Proper escaping for char(3) string, or PHP at fault, or me at fault?
Next
From: Ray Bannon
Date:
Subject: Re: Union Query Improvement