X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 08FFCD1B545 for ; Mon, 20 Oct 2003 13:42:51 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 25585-10 for ; Mon, 20 Oct 2003 10:42:23 -0300 (ADT) Received: from matrix.gatewaynet.com (unknown [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id 24A68D1B4FB for ; Mon, 20 Oct 2003 10:42:18 -0300 (ADT) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id h9KDuAdN030048; Mon, 20 Oct 2003 16:56:10 +0300 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id h9KDuASs030044; Mon, 20 Oct 2003 16:56:10 +0300 Date: Mon, 20 Oct 2003 16:56:10 +0300 (EEST) From: achill@matrix.gatewaynet.com To: "A.Bhuvaneswaran" Cc: Dmitri Fuerle , Subject: Re: Question regarding triggers In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/235 X-Sequence-Number: 15635 On Mon, 20 Oct 2003, A.Bhuvaneswaran wrote: > > Why dont you try to write your trigger in C? > > Hi, one cannot write triggered procedures in C. Currently, it can only be > written in plpsgql. Where did you get that impression from? Do an SELECT tgrelid,tgfoid,proname from pg_trigger,pg_proc where tgfoid=pg_proc.oid and prolang=13; in your system to check if you have any :) > > > > CREATE FUNCTION "public"."check_shipment" () RETURNS trigger AS' > > > begin > > > If new.shipment_type_id = 4 then > > > --do something > > > end if; > > > return new; > > > end; > > > in the above example everything works if shipment_type_id is being > > > updated. If it is not I will receive a run-time error because > > > shipment_type_id is not part of the record new. > > All the fields of updated record must available in NEW variable. Refer > the manual for details. Forward your sql & run-time error for further > assistance. > > regards, > bhuvaneswaran > > -- -Achilleus