Fwd: [SQL] how to use record type

From: Horst Herb <hherb(at)malleenet(dot)net(dot)au>
To: pgsql-novice(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Fwd: [SQL] how to use record type
Date: 2001-08-16 22:24:51
Message-ID: 0108170824511W.01835@munin.gnumed.dhs.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-sql

I have difficulties understanding how to use variable of "record" or "row"
type. 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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2001-08-16 22:55:42 Re: Queries seem to lock up shell session
Previous Message travep 2001-08-16 21:55:58 Queries seem to lock up shell session

Browse pgsql-sql by date

  From Date Subject
Next Message Morgan Curley 2001-08-17 07:29:36 Query Approach and performance
Previous Message Tom Lane 2001-08-16 22:12:31 Re: Nested JOINs