Skip site navigation (1) Skip section navigation (2)

Re: table version history

From: Joel Burton <jburton(at)scw(dot)org>
To: Tom Strickland <tom(at)stricklandc(dot)demon(dot)co(dot)uk>
Cc: Postgres Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: table version history
Date: 2001-04-08 18:44:53
Message-ID: Pine.LNX.4.21.0104081432070.23870-100000@olympus.scw.org (view raw or flat)
Thread:
Lists: pgsql-novice
On Sun, 8 Apr 2001, Tom Strickland wrote:

> I'd like to provide users with history on important tables, so that
> they can go back and examine changes. This is partly to do with the
> UK's Data Protection Act, which states that an organisation must keep
> a log of all changes to information kept on a user. I'd like to have a
> mechanism of being able to print a report on one of our clients that:
> 1) prints all current info on user (easy)
> 2) prints all changes to that user's info (not so easy).

You could add a trigger onto the table so that all updates are inserted
into a log table.





 changeid | fname | lname  |   op   |         chgat          | chgby
----------+-------+--------+--------+------------------------+-------
        1 | joel  | burton | INSERT | 2001-04-08 14:44:25-04 | joel
        2 | pup   | burton | UPDATE | 2001-04-08 14:44:25-04 | joel
        3 | pup   | burton | DELETE | 2001-04-08 14:44:25-04 | joel
-- 
Joel Burton   <jburton(at)scw(dot)org>
Director of Information Systems, Support Center of Washington



In response to

Responses

pgsql-novice by date

Next:From: Joel BurtonDate: 2001-04-08 18:48:49
Subject: Re: table version history
Previous:From: Andrew McMillanDate: 2001-04-08 17:37:46
Subject: Re: copy from multi-line text problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group