Received: from web20604.mail.yahoo.com (web20604.mail.yahoo.com [216.136.226.162]) by postgresql.org (8.11.3/8.11.4) with SMTP id fAN8EKm11921 for ; Fri, 23 Nov 2001 03:14:20 -0500 (EST) (envelope-from mr_ocp@yahoo.com) Message-ID: <20011123081420.12866.qmail@web20604.mail.yahoo.com> Received: from [24.112.241.253] by web20604.mail.yahoo.com via HTTP; Fri, 23 Nov 2001 19:14:20 EST Date: Fri, 23 Nov 2001 19:14:20 +1100 (EST) From: =?iso-8859-1?q?Mr=20OCP?= Subject: Converting a function in C To: pgsql-admin@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Archive-Number: 200111/116 X-Sequence-Number: 2641 Hi Can any one please help me write the following triger in C, your help would be much appreciated /* Archive function */ DROP FUNCTION fn_archive(); CREATE FUNCTION fn_archive() RETURNS OPAQUE AS ' BEGIN /* TG_OP is the function (UPDATE, DELETE, SELECT) */ INSERT INTO adres_archive VALUES (OLD.name,OLD.adres,OLD.tel,current_user,now(),TG_OP); IF TG_OP = ''UPDATE'' THEN NEW.modtime := ''now''; RETURN NEW; END IF; RETURN OLD; END; ' LANGUAGE 'plpgsql'; Tks Mike http://shopping.yahoo.com.au - Yahoo! Shopping - Get organised for Christmas early this year!