Re: Faster NUMERIC implementation - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Faster NUMERIC implementation
Date
Msg-id 24077.1048178913@sss.pgh.pa.us
Whole thread Raw
In response to Re: Faster NUMERIC implementation  (Michael Meskes <meskes@postgresql.org>)
Responses Re: Faster NUMERIC implementation
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: More outdated examples
Next
From: Michael Meskes
Date:
Subject: Re: Faster NUMERIC implementation