Re: Question regarding triggers

From: Dmitri Fuerle <ffo2lp(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Question regarding triggers
Date: 2003-10-20 15:07:13
Message-ID: 20031020150713.89414.qmail@web60205.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Thanks for the help. I discovered my error while coming up with a better example.


Thanks,
Dmitri

"A.Bhuvaneswaran" <bhuvan(at)symonds(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Pohl 2003-10-20 15:36:24 Re: Which is faster SQL or PL/PGSQL
Previous Message achill 2003-10-20 13:56:10 Re: Question regarding triggers