From: Mathieu Arnold <mat@mat.cc>
To: pgsql-sql@postgresql.org
Subject: triggers and plpgsql question
Date: Tue, 27 Aug 2002 18:18:07 +0200
Message-ID: <374862253.1030472287@andromede.reaumur.absolight.net> (raw)
Hi
I want to do a generic function that I can add to triggers to add every
inserts, updates and deletes from many differents tables into a common
format in another table. the idea is :
create function do_it_all () returns opaque '
begin
IF TG_OP = ''INSERT'' THEN
cycle through all of NEW (not knowing what it contains) and do things
with them
ELSIF TG_OP = ''UPDATE'' THEN
cycle through all of NEW (not knowing what it contains) and do things
with them
ELSIF TG_OP = ''DELETE'' THEN
say that NEW.id_||TG_RELNAME has been deleted
END IF;
END;
The thing I need, is to be able to know what does NEW contains, and I have
not found out any mean to do so. If it's not possible to do so, I'll write
a function per table, but for the beauty of all this, I would have liked to
do it the way above.
--
Mathieu Arnold
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: mat@mat.cc
Subject: Re: triggers and plpgsql question
In-Reply-To: <374862253.1030472287@andromede.reaumur.absolight.net>
* 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