Aggregate with external sfunc
От | Tiberiu Stef |
---|---|
Тема | Aggregate with external sfunc |
Дата | |
Msg-id | Pine.GSO.4.33.0207311439310.20511-100000@ector.cs.purdue.edu обсуждение исходный текст |
Ответы |
Re: Aggregate with external sfunc
|
Список | 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
В списке pgsql-general по дате отправления: