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 084A79FA5E7 for ; Fri, 23 Jun 2006 04:15:25 -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 60470-03 for ; Fri, 23 Jun 2006 04:15:21 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from deliver.hol.gr (deliver.hol.gr [194.30.193.27]) by postgresql.org (Postfix) with ESMTP id C9B219FA395 for ; Fri, 23 Jun 2006 04:15:20 -0300 (ADT) Received: from auth-smtp.hol.gr (takeit01.mail.dc.hol.net [192.168.20.71]) by deliver.hol.gr (8.12.11/8.11.6) with ESMTP id k5N7Ee2U002214 (using TLSv1/SSLv3 with cipher DHE-RSA-AES256-SHA (256 bits) verified OK) for ; Fri, 23 Jun 2006 10:14:40 +0300 Received: from pimp (static223128.dsl.hol.gr [62.38.223.129]) by auth-smtp.hol.gr (8.13.1/8.12.11) with ESMTP id k5N7FHjO007409 for ; Fri, 23 Jun 2006 10:15:17 +0300 Message-Id: <200606230715.k5N7FHjO007409@auth-smtp.hol.gr> From: "Forums @ Existanze" To: Subject: Re: Fwd: Start up question about triggers Date: Fri, 23 Jun 2006 10:15:22 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 Thread-Index: AcaWg6dm4l5vWbX1TUidJ1nYRfK61QAELF8A In-Reply-To: <20060623050930.29801.qmail@web31801.mail.mud.yahoo.com> X-Virus-Scanned: ClamAV 0.87/1561/Thu Jun 22 18:40:00 2006 on takeit01.mail.dc.hol.net X-Virus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/256 X-Sequence-Number: 25492 Hello again aaron, Im really interested in the part where you say "generic trigger" can you give me some tips? As to how I will go about that? I had already read the links that Richard gave, I new I could get the values like that. So right now I will have to create a trigger for each of my tables to create the necessary queries, or I could do it "generically" :-) Best Regards, Fotis > -----Original Message----- > From: pgsql-sql-owner@postgresql.org > [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Richard > Broersma Jr > Sent: 23 June 2006 08:10 > To: Aaron Bono; pgsql-sql@postgresql.org > Subject: Re: Fwd: [SQL] Start up question about triggers > > > 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. > > ---------------------------(end of > broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match >