Re: Internal function call from C-language function

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Internal function call from C-language function
Дата
Msg-id 20061207132226.GC19846@svana.org
обсуждение исходный текст
Ответ на Re: Internal function call from C-language function  (Zoltan Boszormenyi <zboszor@dunaweb.hu>)
Ответы Re: Internal function call from C-language function  (Zoltan Boszormenyi <zboszor@dunaweb.hu>)
Список pgsql-general
On Thu, Dec 07, 2006 at 01:40:22PM +0100, Zoltan Boszormenyi wrote:
> text_in() doesn't exists, it's textin() but I have to call it through
> DirectFunctionCall1(), like this:
>
> yeardatum = DirectFunctionCall1(textin, CStringGetDatum("year"));
>
> However, the session crashes on the subsequent
>
> returndatum = DirectFunctionCall2(timestamp_part, yeardatum, timest);

It would be a good idea to actually find out where it crashes, that
would help you work out what the actual problem is. Just looking at the
code you posted, I only see this other bit that looks a bit suspect:

      Datum           timest;
      bool            isnull;

       t = PG_GETARG_HEAPTUPLEHEADER(0);
       timest = DatumGetTimestamp(GetAttributeByName(t, "ts_today", &isnull));

You're calling DatumGetTimestamp() which would return a timestamp
(probably some structure) but you're storing it in a Datum. Just take
the result of GetAttributeByName directly.

Get at least a backtrace next time it crashes...

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

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

Предыдущее
От: Zoltan Boszormenyi
Дата:
Сообщение: Re: Internal function call from C-language function
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: Tsearch2 / PG 8.2 Which stemmer files?