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 2766DD1B4E3 for ; Mon, 20 Oct 2003 15:07: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 39159-02 for ; Mon, 20 Oct 2003 12:07:20 -0300 (ADT) Received: from web60205.mail.yahoo.com (web60205.mail.yahoo.com [216.109.118.100]) by svr1.postgresql.org (Postfix) with SMTP id 9F4EDD1B501 for ; Mon, 20 Oct 2003 12:07:19 -0300 (ADT) Message-ID: <20031020150713.89414.qmail@web60205.mail.yahoo.com> Received: from [24.75.42.210] by web60205.mail.yahoo.com via HTTP; Mon, 20 Oct 2003 08:07:13 PDT Date: Mon, 20 Oct 2003 08:07:13 -0700 (PDT) From: Dmitri Fuerle Subject: Re: Question regarding triggers To: pgsql-sql@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-523230983-1066662433=:89132" X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.2 tagged_above=0.0 required=5.0 tests=EMAIL_ATTRIBUTION, HTML_20_30, IN_REP_TO, QUOTED_EMAIL_TEXT, REPLY_WITH_QUOTES X-Spam-Level: X-Archive-Number: 200310/237 X-Sequence-Number: 15637 --0-523230983-1066662433=:89132 Content-Type: text/plain; charset=us-ascii Thanks for the help. I discovered my error while coming up with a better example. Thanks, Dmitri "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. > > 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 --------------------------------- Do you Yahoo!? The New Yahoo! Shopping - with improved product search --0-523230983-1066662433=:89132 Content-Type: text/html; charset=us-ascii
  Thanks for the help.  I discovered my error while coming up with a better example.
 
 
Thanks,
  Dmitri


"A.Bhuvaneswaran" <bhuvan@symonds.net> 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.

> > 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


Do you Yahoo!?
The New Yahoo! Shopping - with improved product search --0-523230983-1066662433=:89132--