Re: Faster NUMERIC implementation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Faster NUMERIC implementation
Date: 2003-03-20 16:48:33
Message-ID: 24077.1048178913@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Meskes <meskes(at)postgresql(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-03-20 16:55:09 Re: pgsql-server/ oc/src/sgml/manage-ag.sgml oc/sr ...
Previous Message Bruce Momjian 2003-03-20 16:22:01 Re: pgsql-server/ oc/src/sgml/manage-ag.sgml oc/sr ...