pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Broersma Jr <rabroersma@yahoo.com>
To: Aaron Bono <postgresql@aranya.com>
To: pgsql-sql@postgresql.org
Subject: Re: Fwd: Start up question about triggers
Date: Thu, 22 Jun 2006 22:09:30 -0700 (PDT)
Message-ID: <20060623050930.29801.qmail@web31801.mail.mud.yahoo.com> (raw)
In-Reply-To: <bf05e51c0606222017i4637d78cue04e1ed850ae63af@mail.gmail.com>

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



view thread (29+ messages)  latest in thread

Message-ID: <20060623050930.29801.qmail@web31801.mail.mud.yahoo.com>
Permalink:  ../20060623050930.29801.qmail@web31801.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/20060623050930.29801.qmail@web31801.mail.mud.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: rabroersma@yahoo.com, postgresql@aranya.com
  Subject: Re: Fwd: Start up question about triggers
  In-Reply-To: <20060623050930.29801.qmail@web31801.mail.mud.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