Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 864392E0185 for ; Wed, 26 Dec 2007 14:13:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 47644-02 for ; Wed, 26 Dec 2007 14:12:18 -0400 (AST) Received: from web54301.mail.re2.yahoo.com (web54301.mail.re2.yahoo.com [206.190.49.111]) by postgresql.org (Postfix) with SMTP id 9617E2E3141 for ; Wed, 26 Dec 2007 14:12:24 -0400 (AST) Received: (qmail 34774 invoked by uid 60001); 26 Dec 2007 18:11:05 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=WROzTlhhj6Gw75EmDnLLvhE/CFeVvcmlJtIY6vPXHf1R4vK9z+J8ibb+nE+SqGtdg/5efDpDsQvDsIfVYIYQqW8WS1C2YDud+JqR19C0xIrmDHgdvsbNc2izz0w8NCMCStcb4o3qxzOOGxfmxr7vW8z8YeRcLEiLhvG02azq3Gk=; X-YMail-OSG: NYMniPUVM1nCaGsf9z6M2NZOKrU8P5i7jt4H0kr.6djPhEv1Sn8_qRyX4cZcp5Ydx2HqqIP.hN5Vn4ao35FjMOUdR6nwOdV4YRbH060LHEyURpEVKtuy6GEa9vxGF_hSAC3C4AOAxJQISTU- Received: from [71.137.208.147] by web54301.mail.re2.yahoo.com via HTTP; Wed, 26 Dec 2007 10:11:03 PST Date: Wed, 26 Dec 2007 10:11:03 -0800 (PST) From: chester c young Subject: Re: Advice for generalizing trigger functions To: Richard Broersma Jr Cc: sql pgsql In-Reply-To: <781842.52422.qm@web31813.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <918856.33390.qm@web54301.mail.re2.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/133 X-Sequence-Number: 29825 --- Richard Broersma Jr 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