pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Horst Herb <hherb@malleenet.net.au>
To: pgsql-sql@postgresql.org
Subject: how to use record type
Date: Wed, 15 Aug 2001 00:34:33 +1000
Message-ID: <01081500343310.01835@munin.gnumed.dhs.org> (raw)

Help please!

How do I actually insert the variables OLD or NEW or a record type into a 
table from within a trigger?

Like doing the following:

drop table th1;
create table th1(
id serial, 
text text );

drop table th_audit;
create table th1_audit(
ts timestamp default now()
) inherits(th1);

drop function thaudit();
create function thaudit() returns opaque as '
begin
	-- I want to insert OLD into th_audit - how do I do this???
	return NEW;
end; ' language 'plpgsql';

drop trigger ta on th1;
create trigger ta before delete or update on th1
    for each row execute procedure thaudit();

Reagrds,
Horst



view thread (4+ messages)  latest in thread

Message-ID: <01081500343310.01835@munin.gnumed.dhs.org>
Permalink:  ../01081500343310.01835@munin.gnumed.dhs.org/
Also on:    postgresql.org/message-id/01081500343310.01835@munin.gnumed.dhs.org

 · 

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: hherb@malleenet.net.au
  Subject: Re: how to use record type
  In-Reply-To: <01081500343310.01835@munin.gnumed.dhs.org>

* 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