Re: Advice for generalizing trigger functions

From: chester c young <chestercyoung(at)yahoo(dot)com>
To: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
Cc: sql pgsql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Advice for generalizing trigger functions
Date: 2007-12-26 18:11:03
Message-ID: 918856.33390.qm@web54301.mail.re2.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

--- Richard Broersma Jr <rabroersma(at)yahoo(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Wiryawan 2007-12-26 19:19:29 need help
Previous Message Richard Broersma Jr 2007-12-26 00:20:53 Advice for generalizing trigger functions