Received: from akirason.se.verio.net (akirason.se.verio.net [204.27.64.122]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f7HEIQP53381; Fri, 17 Aug 2001 10:18:26 -0400 (EDT) (envelope-from jeckermann@verio.net) Received: from beancounter (no-wkstns.gs.verio.net [204.27.67.225]) (authenticated) by akirason.se.verio.net (8.11.4/8.11.4) with ESMTP id f7HEFsI31261; Fri, 17 Aug 2001 09:15:54 -0500 (CDT) (envelope-from jeckermann@verio.net) Message-ID: <009401c12727$71b3a150$279c10ac@INTERNAL> From: "Jeff Eckermann" To: "Horst Herb" , , References: <0108170824511W.01835@munin.gnumed.dhs.org> Subject: Re: how to use record type Date: Fri, 17 Aug 2001 09:18:10 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Archive-Number: 200108/229 X-Sequence-Number: 4461 I have encountered this problem (in a different context), and could not find a way to insert entire rows/records in the way that you appear to want. But it worked fine if I INSERTed explicitly, like: INSERT INTO table VALUES (OLD.field1, OLD.field2, ..., OLD.fieldn); That should work fine inside a plpgsql function. ----- Original Message ----- From: "Horst Herb" To: ; Sent: Thursday, August 16, 2001 5:24 PM Subject: Fwd: how to use record type > 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 > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > >