Re: poll: CHECK TRIGGER?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: poll: CHECK TRIGGER?
Дата
Msg-id 18274.1330826426@sss.pgh.pa.us
обсуждение исходный текст
Ответ на poll: CHECK TRIGGER?  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Ответы Re: poll: CHECK TRIGGER?
Список pgsql-hackers
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?

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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Collect frequency statistics for arrays
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: poll: CHECK TRIGGER?