Skip site navigation (1) Skip section navigation (2)

Re: Changes to functions and triggers

From: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: hackers(at)PostgreSQL(dot)org
Subject: Re: Changes to functions and triggers
Date: 2000-06-17 10:50:57
Message-ID: m133GBl-000AY3C@druid.net (view raw or flat)
Thread:
Lists: pgsql-hackers
Thus spake Tom Lane
> darcy(at)druid(dot)net (D'Arcy J.M. Cain) writes:
> > Something changed in 7.02 from 6.3.  I used to do this:
> > CREATE FUNCTION make_date()  
> >     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);   
> 
> > This no longer works.
> 
> Details?

Same error as I gave for the new version I wrote.

> > 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?  I took it right from
the web page documentation.

> There's surely been a lot of changes in 7.0 that could have broken
> user-written triggers, but you'll need to look to your C code to
> find the problem.  What you've shown us looks fine.

Really?  That code always worked before.  Besides, it doesn't look to me
like my C code ever gets called.  The failure seems to be at the SQL
level saying that there is no function to call.

-- 
D'Arcy J.M. Cain <darcy(at){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.

In response to

Responses

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2000-06-17 13:00:24
Subject: Install modes
Previous:From: Hiroshi InoueDate: 2000-06-17 09:38:53
Subject: RE: OK, OK, Hiroshi's right: use a seperately-generated filename

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group