Re: c-function returns multiple rows

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: c-function returns multiple rows
Дата
Msg-id 8918.1061560348@sss.pgh.pa.us
обсуждение исходный текст
Ответ на c-function returns multiple rows  (Kirill Krasnosselov <kirill@digicol.de>)
Ответы Re: c-function returns multiple rows  (Joe Conway <mail@joeconway.com>)
Список pgsql-novice
Kirill Krasnosselov <kirill@digicol.de> writes:
> PG_FUNCTION_INFO_V1(dc_ftx);
> Datum
> dc_ftx(PG_FUNCTION_ARGS)
>   { ReturnSetInfo* rsi = (ReturnSetInfo *)fcinfo->resultinfo;
>     rsi->isDone = ExprEndResult;
>     PG_RETURN_NULL();
>   }

This looks like it should work, but you're living dangerously
by not checking that you're being called the way you expect.
You should have something like

    if (!fcinfo->resultinfo || !IsA(fcinfo->resultinfo,ReturnSetInfo))
        elog(ERROR, ...);

in there before trying to dereference the pointer.

> In my opinion this function call shall returns a empty table,
> but this call does not end.

Try attaching to the backend with a debugger to see what it's doing.

            regards, tom lane

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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: c-function returns multiple rows
Следующее
От: Luis Hernán Otegui
Дата:
Сообщение: Clusters and pgsql