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 0700DD1B52D for ; Mon, 20 Oct 2003 13:09:19 +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 16799-09 for ; Mon, 20 Oct 2003 10:08:51 -0300 (ADT) Received: from matrix.gatewaynet.com (unknown [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id D74FCD1B53D for ; Mon, 20 Oct 2003 10:08:45 -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 h9KDMddN029920; Mon, 20 Oct 2003 16:22:39 +0300 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id h9KDMdYK029916; Mon, 20 Oct 2003 16:22:39 +0300 Date: Mon, 20 Oct 2003 16:22:39 +0300 (EEST) From: achill@matrix.gatewaynet.com To: Dmitri Fuerle Cc: pgsql-sql@postgresql.org Subject: Re: Question regarding triggers In-Reply-To: <20031020130058.61589.qmail@web60210.mail.yahoo.com> 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/233 X-Sequence-Number: 15633 Why dont you try to write your trigger in C? On Mon, 20 Oct 2003, Dmitri Fuerle wrote: > > I'm writing a trigger but running into problems. My problem is that I can not determine anyway to tell what fields are in the *new* record. Without knowing what fields are there I get runtime errors if that's not what is being updated example: > > 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. > > Please help, > Dmitri > > > > > --------------------------------- > Do you Yahoo!? > The New Yahoo! Shopping - with improved product search -- -Achilleus