Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group