Thread: fmgr.h vs funcapi.h?

fmgr.h vs funcapi.h?

From
Magnus Hagander
Date:
I was writing a simple standalone function compiled with pgxs - been a
while since I did that.

Including "postgres.h" and "fmgr.h", it didn't work - the backend would
complain that the function did not exist in the shared library.
Including "postgres.h" and "funcapi.h" *did* work - no complaints.

From what I can find in the docs, fmgr.h is the one to use as long as
you don't need to do set returning functions (mine is a simpe
int-returning function).

Docs issue, code issue, or Magnus-issue?

//Magnus


Re: fmgr.h vs funcapi.h?

From
Tom Lane
Date:
Magnus Hagander <magnus@hagander.net> writes:
> I was writing a simple standalone function compiled with pgxs - been a
> while since I did that.

> Including "postgres.h" and "fmgr.h", it didn't work - the backend would
> complain that the function did not exist in the shared library.
> Including "postgres.h" and "funcapi.h" *did* work - no complaints.

I can't recall ever having had to do that.  Can you show a complete
example (including the Makefile you're using)?
        regards, tom lane


Re: fmgr.h vs funcapi.h?

From
Magnus Hagander
Date:
Tom Lane wrote:
> Magnus Hagander <magnus@hagander.net> writes:
>> I was writing a simple standalone function compiled with pgxs - been a
>> while since I did that.
> 
>> Including "postgres.h" and "fmgr.h", it didn't work - the backend would
>> complain that the function did not exist in the shared library.
>> Including "postgres.h" and "funcapi.h" *did* work - no complaints.
> 
> I can't recall ever having had to do that.  Can you show a complete
> example (including the Makefile you're using)?

Pah, ignore that. It was a combination of me working when I really
should've gone home, a connection pooler and somebody else working on
the same database.

Bottom line: it wasn't the change of fmgr.h that fixed it, it was the
fact that the backend was actually not restarted in the first test so it
had an old version of the shared lib!

D'uh. Apologies.

//Magnus