| From: | "rob" <robklaus(at)gmail(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Dynamic datalogging function/scheme |
| Date: | 2006-02-15 18:10:29 |
| Message-ID: | 1140027029.485974.273400@g47g2000cwa.googlegroups.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hello,
Looking for advice on creating as dynamic a datalogging scheme as I can
using plpgsql.
The idea would be to have a trigger function that I could drop on any
table in my database. Then on update, the function would iterate
through each field, and check to see if NEW.<fieldname> <>
OLD.<fieldname>. Then a function would be called that would insert
data into a logging table.
I can do this in a very static sense whereby each table has its own
specific trigger function that specifies each column by name
(NEW.co_name <> OLD.co_name), etc. But, this is pretty cumbersome, and
as new columns are added, we would need to remember to go in and change
the function.
Running Postgresql 8.1
Thanks for any advice/help!
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Crozier | 2006-02-15 19:04:55 | Re: Date last vacuum |
| Previous Message | Matthew T. O'Connor | 2006-02-15 17:48:50 | Re: vacuumdb out of memory error |