Re: Why does load_external_function() return PGFunction?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why does load_external_function() return PGFunction?
Date: 2018-02-06 20:43:29
Message-ID: 30501.1517949809@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> We've several callers to load_external_function() that do not use the
> returned value as a PGFunction. I'd vote for changing the return type to
> void * and have fmgr.c cast it to PGFunction after verifying the
> function's magic.

void* isn't necessarily compatible with function pointers --- there are
platforms where they're physically different widths, though possibly
you'd never get PG to run on such hardware anyway.

I'd be OK with declaring it as a more generic function pointer type,
perhaps "void (*funcptr) ()".

However, given that a cast is going to be necessary anyway, it seems
like this is mostly useless churn...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stefan Kaltenbrunner 2018-02-06 20:46:40 Re: git instructions
Previous Message Peter Geoghegan 2018-02-06 20:40:41 Re: Add PGDLLIMPORT to enable_hashagg