X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 25DD69FA5E7 for ; Fri, 23 Jun 2006 02:09:41 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 42778-09 for ; Fri, 23 Jun 2006 02:09:32 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web31801.mail.mud.yahoo.com (web31801.mail.mud.yahoo.com [68.142.207.64]) by postgresql.org (Postfix) with SMTP id 137FA9FA395 for ; Fri, 23 Jun 2006 02:09:31 -0300 (ADT) Received: (qmail 29803 invoked by uid 60001); 23 Jun 2006 05:09:30 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=i9i2fkxAMYMWeEZj7fG17a7TP6iKs75zfuHa7Kp747ExET1knJqibk72WwwR0wXPZIMur2yghvVj6aDjgrgTq4KiAy0+39t4HDudxZm1sq2szV7XxR04GTXLwMLWIAFj6uvrqiFbJUdKozoi+eFISQ5ELVnlZNndRknpZHwNXZU= ; Message-ID: <20060623050930.29801.qmail@web31801.mail.mud.yahoo.com> Received: from [24.54.196.198] by web31801.mail.mud.yahoo.com via HTTP; Thu, 22 Jun 2006 22:09:30 PDT Date: Thu, 22 Jun 2006 22:09:30 -0700 (PDT) From: Richard Broersma Jr Subject: Re: Fwd: Start up question about triggers To: Aaron Bono , pgsql-sql@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/255 X-Sequence-Number: 25491 > I did some research and can't even find a way to get meta data in a trigger. > > In a trigger, is there a way to inspect OLD and NEW to see what columns are > there and see what has changed? If so, you may not be able to grab the > actual query but you could create a generic trigger that reconstructs a > possible update/insert/delete for any table in your database. > > Does anyone know of a good place to go get information about using meta data > in a stored procedure or trigger? yes. See the section "User Comments" at the very bottom of Chapter 33 after "Writing Trigger Functions in C". It is odd that a PL_PGSQL example is given at the end a chapter for triggers written in C. http://www.postgresql.org/docs/8.1/interactive/trigger-example.html Also see the entire chapter 36.10 "Trigger Procedures" http://www.postgresql.org/docs/8.1/interactive/plpgsql-trigger.html Hope this is what you are looking for. Regards, Richard Broersma Jr.