Re: Changes to functions and triggers

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Changes to functions and triggers
Дата
Msg-id 19222.961261415@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Changes to functions and triggers  (darcy@druid.net (D'Arcy J.M. Cain))
Ответы Re: Changes to functions and triggers  (darcy@druid.net (D'Arcy J.M. Cain))
Список pgsql-hackers
darcy@druid.net (D'Arcy J.M. Cain) writes:
>>>> I looked and the docs and it seems that this should work instead.
>> 
>>>> CREATE FUNCTION make_date(date, int, int, int)  
>>>> RETURNS opaque
>>>> AS '/usr/pgsql/modules/make_date.so' 
>>>> LANGUAGE 'c';
>>>> CREATE TRIGGER make_edate
>>>> BEFORE INSERT OR UPDATE ON bgroup
>>>> FOR EACH ROW
>>>> EXECUTE PROCEDURE make_date('edate', 'aniv', 'emon', 'eyear');   
>> 
>> No.  Trigger procedures never take explicit arguments --- whatever
>> you may have stated in the CREATE TRIGGER command gets passed in
>> in the trigger data structure.  (A pretty bizarre and ugly choice
>> if you ask me, but not worth breaking existing code to change...)

> Hmm.  Are you saying that the above is wrong?

Yes.

> I took it right from the web page documentation.

What web page?  http://www.postgresql.org/docs/postgres/triggers.htm
still says what it always has (complete with bad grammar ;-)):
The trigger function must be created before the trigger iscreated as a function taking no arguments and returns
opaque.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: create user and transactions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Install modes