Re: C Function returning a tuple with a float4 array as column

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: C Function returning a tuple with a float4 array as column
Дата
Msg-id 200.1291581799@sss.pgh.pa.us
обсуждение исходный текст
Ответ на C Function returning a tuple with a float4 array as column  (Tim <tim.child@comcast.net>)
Ответы Re: C Function returning a tuple with a float4 array as column
Список pgsql-novice
Tim <tim.child@comcast.net> writes:
> Anyone have any ideas what wrong  with my C code to return a tuple with
> 1 column that is a float4 array. I have tested  functions returning  a
> float4 array and a row and both  work independently. When I combine the
>   code  I get  the SQL error

> ERROR:  cache lookup failed for type 0

I don't think that has anything directly to do with the float4 array.
You'd be well ahead of the game if you cranked up gdb to see exactly
where the error is coming from (set a breakpoint at errfinish and
backtrace from there).  But what seems likely to be the problem is that
you've declared the function to return set (that's implied by the
RETURNS TABLE syntax) but not coded it to do any such thing.  I'm
guessing some piece of code is confused by the function's failure to
follow the SRF API.

FWIW, this is backwards:

>      /**  Set up the column Datum for the Tuple **/
>      column[0] = DatumGetPointer(arrayType);

Should be PointerGetDatum.  Now generally both of those are no-op
casts, so the difference is cosmetic.  It does however suggest that
you are either compiling without warnings or ignoring the warnings,
neither of which is a path to success in dealing with C code.

            regards, tom lane

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

Предыдущее
От: Tim
Дата:
Сообщение: C Function returning a tuple with a float4 array as column
Следующее
От: Tom Lane
Дата:
Сообщение: Re: C Function returning a tuple with a float4 array as column