Received: from mailsys01.intnet.net (tmail.wwc.com [198.252.32.143] (may be forged)) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f12JwJq10969 for ; Fri, 2 Feb 2001 14:58:19 -0500 (EST) (envelope-from joe.conway@mail.com) Received: from [134.24.34.227] (HELO jecw2k1) by mailsys01.intnet.net (CommuniGate Pro SMTP 3.3.2) with SMTP id 3268361 for pgsql-interfaces@postgresql.org; Fri, 02 Feb 2001 14:57:51 -0500 Message-ID: <00f501c08d52$6dd1baf0$82d410ac@jecw2k1> Reply-To: "Joe Conway" From: "Joe Conway" To: Subject: C function for use from PLpgSQL trigger Date: Fri, 2 Feb 2001 11:57:51 -0800 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.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Archive-Number: 200102/9 X-Sequence-Number: 959 Hi, I'm trying to create a C function that I can call from within a PLpgSQL trigger function which will return a list of all the values in the NEW record formatted suitably for an insert statement. I can't come up with a way to do this directly from within PLpgSQL (i.e. iterate through an arbitrary number of NEW.attribute). Can anyone tell me how I can either pass the NEW record to the C function (this produces an error message 'NEW used in a non-rule query') or gain access to the trigger tuple from within my C function? It seems that although PLpgSQL is called as a trigger, the C function is called as a regular function (makes sense) and thus has no access to the trigger tuple (my problem). Any help or guidance is greatly appreciated! Thanks, Joe Conway