Alvaro Herrera <alvhe...@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? 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. Now, if there's no intention of ever making the code actually apply checks of the sort I'm thinking of, maybe CHECK FUNCTION AS TRIGGER is fine. > One thing to consider is eventual support for triggers that use > anonymous function blocks, without a previous CREATE FUNCTION, which is > being discussed in another thread. Yeah, that angle seems to be another reason to support CHECK TRIGGER. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers