From: | Tiberiu Stef <tstef(at)cs(dot)purdue(dot)edu> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Aggregate with external sfunc |
Date: | 2002-07-31 19:42:19 |
Message-ID: | Pine.GSO.4.33.0207311439310.20511-100000@ector.cs.purdue.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Problem: New aggregate, with custom-made functions, crashes connection.
I want to add a new aggregate (based on C functions) and I'm stuck :
I created a C function:
CREATE OR REPLACE FUNCTION fintransfunc(double precision,double precision)
RETURNS double precision AS '$libdir/finops.so' LANGUAGE C;
fintransfunc is exactly the same as float8smaller (which is used in the
min(float) aggregate).
finops.so is the library containing the fintransfunc, which I built and
placed in /usr/lib/pgsql/.
I tested fintransfunc with select fintransfunc(2,4); and it worked fine.
Then I defined the aggregate:
create aggregate finmin (sfunc=fintransfunc, basetype = double precision
,stype= double precision );
When I tested it ( select finmin(row) from table ) it resets my database
connection:
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!#
However, if I replace in the aggregate creation the fintransfunc with
float8smaller, and then test again, the query goes through and produces
the desired result.
Are there any issues with using for aggregate definitions functions that
are
in custom-made libraries ?
>From my tests, I guess the aggregate interpreter fails to find a function
that is not in the default postgres server library.
Can anyone help me out here ?
Thanks
T.Stef
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Bacon | 2002-07-31 19:45:19 | Re: Restore killing the backend |
Previous Message | Stephen Bacon | 2002-07-31 19:15:37 | Re: Restore killing the backend |