pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: chester c young <chestercyoung@yahoo.com>
To: Richard Broersma Jr <rabroersma@yahoo.com>
Cc: sql pgsql <pgsql-sql@postgresql.org>
Subject: Re: Advice for generalizing trigger functions
Date: Wed, 26 Dec 2007 10:11:03 -0800 (PST)
Message-ID: <918856.33390.qm@web54301.mail.re2.yahoo.com> (raw)
In-Reply-To: <781842.52422.qm@web31813.mail.mud.yahoo.com>

--- 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



view thread (7+ messages)  latest in thread

Message-ID: <918856.33390.qm@web54301.mail.re2.yahoo.com>
Permalink:  ../918856.33390.qm@web54301.mail.re2.yahoo.com/
Also on:    postgresql.org/message-id/918856.33390.qm@web54301.mail.re2.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: chestercyoung@yahoo.com, rabroersma@yahoo.com
  Subject: Re: Advice for generalizing trigger functions
  In-Reply-To: <918856.33390.qm@web54301.mail.re2.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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