Re: Adding audit trail fields and triggers to all tables

From: David Fetter <david(at)fetter(dot)org>
To: Andrus <kobruleht2(at)hot(dot)ee>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Adding audit trail fields and triggers to all tables
Date: 2007-02-15 18:13:30
Message-ID: 20070215181330.GD3282@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Feb 14, 2007 at 06:38:40PM +0200, Andrus wrote:
> I need to add the following fields to all tables to existing 8.1 database:

Why redo work?

<http://pgfoundry.org/projects/tablelog/>

<http://www.postgresql.org/docs/current/static/plpgsql-trigger.html#PLPGSQL-TRIGGER-AUDIT-EXAMPLE>

Cheers,
D
>
>
> 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.
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc Evans 2007-02-15 18:21:03 Database performance comparison paper.
Previous Message Ron Johnson 2007-02-15 18:12:08 Re: Union Query Improvement