pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Keeping information changes history
2+ messages / 2 participants
[nested] [flat]

* Keeping information changes history
@ 2002-01-24 18:32 Marius Andreiana <marius@wdg.ro>
  2002-01-24 19:00 ` Re: Keeping information changes history Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Marius Andreiana @ 2002-01-24 18:32 UTC (permalink / raw)
  To: pgsql-sql

Hi

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)

Any suggestions for improving or confirmations that this approach will
do the job greatly appreciated!

-- 
Marius Andreiana
--
You don't have to go to jail for helping your neighbour
http://www.gnu.org/philosophy/




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Keeping information changes history
  2002-01-24 18:32 Keeping information changes history Marius Andreiana <marius@wdg.ro>
@ 2002-01-24 19:00 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2002-01-24 19:00 UTC (permalink / raw)
  To: Marius Andreiana <marius@wdg.ro>; +Cc: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-01-24 19:00 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-01-24 18:32 Keeping information changes history Marius Andreiana <marius@wdg.ro>
2002-01-24 19:00 ` Tom Lane <tgl@sss.pgh.pa.us>

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