Excerpts from Tom Lane's message of sáb mar 03 23:00:26 -0300 2012:
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > Pavel's patch for CHECK FUNCTION is adding another command besides that
> > one, which is CHECK TRIGGER. The idea behind this is that you give it
> > the relation to which the trigger is attached in addition to the trigger
> > name, and it checks the function being called by that trigger.
>
> > IMHO having a separate command for this is not warranted. It seems to
> > me that we could simply have a variant of CREATE FUNCTION for this; I
> > proposed CREATE FUNCTION trigfunc() AS TRIGGER ON tabname.
>
> You mean "CHECK FUNCTION ..." right?
Yeah, sorry.
> In principle the CHECK TRIGGER command could apply more checks than
> are possible with the proposed CHECK FUNCTION syntax: in particular,
> AFAICS "AS TRIGGER ON tabname" doesn't provide enough info to know
> whether the function should expect new and/or old rows to be provided,
> nor what it ought to return (which is different for BEFORE/AFTER cases,
> STATEMENT cases, etc). We could add all that info to the CHECK FUNCTION
> syntax, but there's definitely some merit to defining the check as
> occurring against an existing trigger definition instead.
Uh! Now that I read this I realize that what you're supposed to give to
CHECK TRIGGER is the trigger name, not the function name! In that
light, using CHECK FUNCTION for this doesn't make a lot of sense.
Okay, CHECK TRIGGER it is.
--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support