pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedHelp! Record logging
2+ messages / 2 participants
[nested] [flat]
* Help! Record logging
@ 2001-05-16 17:30 Edwin S. Ramirez <ramirez@lwbeyond.net>
2001-05-19 11:59 ` Re: Help! Record logging Richard Huxton <dev@archonet.com>
0 siblings, 1 reply; 2+ messages in thread
From: Edwin S. Ramirez @ 2001-05-16 17:30 UTC (permalink / raw)
To: pgsql-sql
Hello,
I would like to setup a trigger to keep track of all changes done
onto the records of paticular tables. Basically, there would be two
identical tables such as, 'medications' and 'medications_log', when a
user inserts, updates or deletes a record I would like a copy to be
inserted into the log table. I already have audit information in the
medications table, so I only need to be able to copy the record over to
the log table.
The only other difficulty is how do I let the trigger know the ID of
the user deleting the record?
Thanks,
Edwin S. Ramirez
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Help! Record logging
2001-05-16 17:30 Help! Record logging Edwin S. Ramirez <ramirez@lwbeyond.net>
@ 2001-05-19 11:59 ` Richard Huxton <dev@archonet.com>
0 siblings, 0 replies; 2+ messages in thread
From: Richard Huxton @ 2001-05-19 11:59 UTC (permalink / raw)
To: Edwin S. Ramirez <ramirez@lwbeyond.net>; +Cc: pgsql-sql
"Edwin S. Ramirez" wrote:
>
> Hello,
>
> I would like to setup a trigger to keep track of all changes done
> onto the records of paticular tables.
Check my PostgreSQL Notes on techdocs.postgresql.org - there's an
example in there. Might be worth checking Roberto Mello's postgresql
cookbook too (same place).
> The only other difficulty is how do I let the trigger know the ID of
> the user deleting the record?
SELECT CURRENT_USER sounds like what you want.
- Richard Huxton
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-05-19 11:59 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-05-16 17:30 Help! Record logging Edwin S. Ramirez <ramirez@lwbeyond.net>
2001-05-19 11:59 ` Richard Huxton <dev@archonet.com>
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