Re: Changes to functions and triggers

Поиск
Список
Период
Сортировка
От darcy@druid.net (D'Arcy J.M. Cain)
Тема Re: Changes to functions and triggers
Дата
Msg-id m134NdW-000AY3C@druid.net
обсуждение исходный текст
Ответ на Re: Changes to functions and triggers  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Changes to functions and triggers  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Changes to functions and triggers  (darcy@druid.net (D'Arcy J.M. Cain))
Список pgsql-hackers
Thus spake Tom Lane
> 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 is
>     created as a function taking no arguments and returns opaque.

OK, so I went back to basically what I had before.

CREATE FUNCTION make_date()                      RETURNS opaque   AS '/usr/pgsql/modules/make_date.so'       LANGUAGE
'c';

CREATE TRIGGER make_dates   BEFORE INSERT OR UPDATE ON bgroup   FOR EACH ROW   EXECUTE PROCEDURE make_date (edate,
aniv,emon, eyear);
 

INSERT INTO bgroup (bname, client_id, actypid, aniv, emon, eyear, pmon, pyear)VALUES ('guest', 1000, 1, 1, 1, 2000, 1,
2000);

And here is what I get.

ERROR:  fmgr_info: function 24224: cache lookup failed

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


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

Предыдущее
От: "Hiroshi Inoue"
Дата:
Сообщение: RE: Big 7.1 open items
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Big 7.1 open items