Thus spake Zeugswetter Andreas
> > darcy@druid.net (D'Arcy J.M. Cain) writes:
> > >     nargs = trigger->tgnargs;
> > >     if (nargs != 4)
> > >         elog(ERROR, "make_date (%s): %d args", relname, nargs);
> 
> The simple answer is, that your procedure does not take four arguments.
> The old and new tuple are passed implicitly to your procedure,
> they don't show up in the argument list.

Right.  That's why the function takes void as its parameter list.  (I hadn't
shown that in my message.)  The code above finds the args from the global
environment.

In fact, my problem was, I think, that I needed to use the SPI_connect() and
SPI_finish() functions which I don't think were available when I first wrote
the function.  I added those, recompiled and all now works.  It just took
me a while to realize that the problem was in the C code and not the SQL
statements to use it.

> This is also the reason your code works if you add four "dummy" string 
> arguments (you can test that by supplying random values not the column names
> in your create trigger statement).

Nope.  Without the fix above it didn't work no matter what I tried.

Thanks for everyone's help.  Now I can move on to the operator defining
problem but that's a subject for another message.

It's funny but the two areas inthe new version that I am having trouble
with are the two that I originally helped document.  :-)

-- 
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.

Thu, 22 Jun 2000 09:59:26 -0400 (EDT)
darcy@druid.net (D'Arcy J.M. Cain)
Re: Changes to functions and triggers