Re: Bug #440: trigger can not find a function

From: "Stephan Szabo" <acroyear_07030(at)yahoo(dot)com>
To: <am(at)adomos(dot)com>, <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Bug #440: trigger can not find a function
Date: 2001-09-06 15:48:31
Message-ID: 009a01c136eb$635f50d0$014ba8c0@myst.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> Sample Code
> CREATE FUNCTION check_key(varchar,varchar) RETURNS OPAQUE AS '
> BEGIN
> IF COUNT(*) FROM $2 WHERE $2.$1=NEW.$1 THEN
> RAISE EXCEPTION ''integrity violation : duplicated key'';
> END IF;
> RETURN NEW;
> END;
> ' LANGUAGE 'plpgsql';
>
> CREATE TRIGGER trigger_check_key BEFORE INSERT OR UPDATE
> ON bar
> FOR EACH ROW EXECUTE PROCEDURE check_key('id','foo');

Trigger functions take no arguments and return opaque. The arguments given
on the create trigger statement are passed in a special fashion (for plpgsql
look at TG_NARGS and TG_ARGV array).

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2001-09-06 16:11:30 Re: Using nulls with earthdistance operator crashes backend
Previous Message Peter Eisentraut 2001-09-06 15:45:25 Re: Build problem with CVS version