X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1C729D1EDCF for ; Mon, 5 Apr 2004 18:18:35 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 95519-04 for ; Mon, 5 Apr 2004 15:18:55 -0300 (ADT) Received: from davinci.ethosmedia.com (server228.ethosmedia.com [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 1F451D1EDAF for ; Mon, 5 Apr 2004 15:18:23 -0300 (ADT) Received: from [63.195.55.98] (HELO 192.168.1.29) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 4776024; Mon, 05 Apr 2004 11:20:22 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Gavin" , pgsql-sql@postgresql.org Subject: Re: Function To Log Changes Date: Mon, 5 Apr 2004 10:18:26 -0700 User-Agent: KMail/1.5.4 References: <50616.63.65.2.36.1081184499.squirrel@www.grabias.com> In-Reply-To: <50616.63.65.2.36.1081184499.squirrel@www.grabias.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200404051018.26429.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/20 X-Sequence-Number: 17395 Gavin, > Hi All, I have been tinkering with a function to log the changes made on > any column through a function and trigger. However, I cant think of a way > to make this work through pl/pgsql. Any one have any ideas, or is it just > not possible? It could be done, but would be extremely slow and awkward using current PL/ pgsql syntax. You'd have to query the system tables for a list of columns, and then execute a series of dynamic queries. I recommend instead one of the following two approaches: 1) Simply log the whole row of each archived table and don't worry about logging the individual columns, or 2) Use PL/tcl, PL/Pyton, or C where you can select columnns by ordinal position or other dynamic factor. -- -Josh Berkus Aglio Database Solutions San Francisco