Received: from femail3.sdc1.sfba.home.com (femail3.sdc1.sfba.home.com [24.0.95.83]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1484Qx70984 for ; Sun, 4 Feb 2001 03:04:26 -0500 (EST) (envelope-from jconway2@home.com) Received: from jecw2k1 ([24.0.42.111]) by femail3.sdc1.sfba.home.com (InterMail vM.4.01.03.00 201-229-121) with SMTP id <20010204080231.LGSU21891.femail3.sdc1.sfba.home.com@jecw2k1> for ; Sun, 4 Feb 2001 00:02:31 -0800 Message-ID: <022101c08e81$088d0980$0705a8c0@jecw2k1> Reply-To: "Joe Conway" From: "Joe Conway" To: Subject: Fw: C function for use from PLpgSQL trigger Date: Sun, 4 Feb 2001 00:04:00 -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/27 X-Sequence-Number: 1195 Hello all, I posted this (see below) Friday to the interfaces list with no response. Does anyone know if what I'm trying to do is possible, or should I just write the entire thing in a C function trigger? The latter would be unfortunate because I think it would be nice to be able to extend PLpgSQL using C functions like this. Anyway, any help or advice will be much appreciated! Thanks, Joe > 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 >