Re: Advice for generalizing trigger functions - Mailing list pgsql-sql

From chester c young
Subject Re: Advice for generalizing trigger functions
Date
Msg-id 918856.33390.qm@web54301.mail.re2.yahoo.com
Whole thread Raw
In response to Advice for generalizing trigger functions  (Richard Broersma Jr <rabroersma@yahoo.com>)
Responses Re: Advice for generalizing trigger functions
List pgsql-sql
--- Richard Broersma Jr <rabroersma@yahoo.com> wrote:

> I've created quite a few functions that log modifications to various
> history tables. (the history table has the same name as the base
> table but is prefixed by the 'History.' schema.) The only difference
> between functions I can find is the table name.

the problem is that prepared code is referenced by oid, not name.  so
any structural references need to by dynamic.

what I do for change log is to have one change log table with table_id
and column_id attributes that refer by to my internal meta_table and
meta_column tables.  this always works and is in the end, I have found,
a bit more flexible, allowing you to search for changed columns, for
example.

but I still generate the change triggers.  in this case from in my
meta_table and meta_column tables I note which table/columns I want
changes tracked.  those can be changed at any time, but the change log
triggers need to be recompiled.


     ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs


pgsql-sql by date:

Previous
From: Richard Broersma Jr
Date:
Subject: Advice for generalizing trigger functions
Next
From: "A. Wiryawan"
Date:
Subject: need help