Received: from gnumed.dhs.org (modem59.malleenet.net.au [203.143.67.123] (may be forged)) by postgresql.org (8.11.3/8.11.4) with SMTP id f7GMO3P59828 for ; Thu, 16 Aug 2001 18:24:03 -0400 (EDT) (envelope-from hherb@malleenet.net.au) Received: (qmail 27585 invoked by uid 8); 16 Aug 2001 22:23:56 -0000 Received: from pc-00071.e-smith.gnumed.dhs.org (192.168.1.71, claiming to be "munin.gnumed.dhs.org") by bifrost.e-smith.gnumed.dhs.org with SMTP id smtpdSXTl0B; Fri, 17 Aug 2001 08:23:52 EST Content-Type: text/plain; charset="iso-8859-1" From: Horst Herb To: pgsql-novice@postgresql.org, pgsql-sql@postgresql.org Subject: Fwd: [SQL] how to use record type Date: Fri, 17 Aug 2001 08:24:51 +1000 X-Mailer: KMail [version 1.2] MIME-Version: 1.0 Message-Id: <0108170824511W.01835@munin.gnumed.dhs.org> Content-Transfer-Encoding: 8bit X-Archive-Number: 200108/74 X-Sequence-Number: 1883 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