Michael Meskes <meskes@postgresql.org> writes:
> How about some wrapper frunctions in the backend that just call their
> helper functions in the lib?
I'm not willing to do that for any very large number of functions; the
code clutter and runtime overhead would become significant.
I had some visions, back when we were first doing the v1-call-convention
stuff, that it might be possible to make a script that automatically
interprets
Datum
numeric_add(PG_FUNCTION_ARGS)
{Numeric num1 = PG_GETARG_NUMERIC(0);Numeric num2 = PG_GETARG_NUMERIC(1);
...
PG_RETURN_NUMERIC(res);
}
and generates a derived version like
Numeric
numeric_add(Numeric num1, Numeric num2)
{...
return res;
}
We'd probably have to tighten the consistency of formatting a little
to make that workable, but it seems more attractive than manually
maintaining either two sets of code or a wrapper layer.
But before you get too excited about that, there's also the
error-handling issue --- and I'm definitely not interested in changing
all the subroutines away from elog to funny-return-value conventions.
regards, tom lane