Re: Internal function call from C-language function

From: Zoltan Boszormenyi <zboszor(at)dunaweb(dot)hu>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Internal function call from C-language function
Date: 2006-12-07 12:40:22
Message-ID: 45780BB6.8060805@dunaweb.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout írta:
> On Thu, Dec 07, 2006 at 12:55:47PM +0100, Zoltan Boszormenyi wrote:
>
>> However, I have another problem. I have this in the code:
>>
>
> <snip>
>
>
>> yeardatum = CStringGetDatum("year");
>> elog(NOTICE, "CStringGetDatum() 1 OK");
>> returndatum = DirectFunctionCall2(timestamp_part, yeardatum,
>> timest);
>>
>
> You're passing a cstring as first argument, whereas I'm fairly sure you
> should be passing text. When calling from C the're no argument
> checking. I think what you're looking for is:
>
> yeardatum = text_in("year");
>
> Or something like that.
>
> Hope this helps,
>

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);

Best regards,

Zoltán

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-12-07 13:22:26 Re: Internal function call from C-language function
Previous Message Ragnar 2006-12-07 12:26:04 Re: Online index builds