Re: Aggregate with external sfunc

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Aggregate with external sfunc
Дата
Msg-id 14457.1028316207@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Aggregate with external sfunc  (Tiberiu Stef <tstef@cs.purdue.edu>)
Список pgsql-general
Tiberiu Stef <tstef@cs.purdue.edu> writes:
> I created a C function:
> CREATE OR REPLACE FUNCTION fintransfunc(double precision,double precision)
> RETURNS double precision AS '$libdir/finops.so' LANGUAGE C;

You probably want to mark it strict (WITH (isStrict)), unless it's
prepared to deal with NULL inputs.  I'm betting your table contains
some NULLs.

> 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.

float8smaller is marked isStrict ...

> From my tests, I guess the aggregate interpreter fails to find a function
> that is not in the default postgres server library.

No, your routine is dumping core on a null pointer dereference, as you
should have been able to find out for yourself with a debugger.  If you
don't know how to use gdb or some other debugger, writing C functions is
not going to be much fun for you.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: "scott.marlowe"
Дата:
Сообщение: Re: MySQL vs. PostgreSQL
Следующее
От: Tom Lane
Дата:
Сообщение: Re: How i can empty the buffers of a db