From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marius Andreiana <marius@wdg.ro>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: Keeping information changes history
Date: Thu, 24 Jan 2002 14:00:02 -0500
Message-ID: <16617.1011898802@sss.pgh.pa.us> (raw)
In-Reply-To: <1011897177.2277.13.camel@aurora.wdg.ro>
References: <1011897177.2277.13.camel@aurora.wdg.ro>
Marius Andreiana <marius@wdg.ro> writes:
> I need to keep information changes history for people in our
> application.
> e.g. when their address was changed I need to remember who changed it
> (staff or member), when and to what was changed.
> I don't know what's the standard approach to this problem. I thought
> of having another address table, say addresses_history, same structure
> as usual table, but with some extra fields: type of user and user id who
> made the change, and time stamp.
> Every time a change is made to addresses table also insert the proper
> record in addresses_history with a trigger. But I need to know
> information about the user who changed it in database, not only the
> application, so where to keep it?
> So I should add other columns to addresses table for this (user id and
> type of user)
Yup, that's the standard approach, and using triggers to add entries to
the history table is exactly how it's done.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, marius@wdg.ro
Subject: Re: Keeping information changes history
In-Reply-To: <16617.1011898802@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox