Re: Problem with heap_form_tuple error

Поиск
Список
Период
Сортировка
От Stephen Woodbridge
Тема Re: Problem with heap_form_tuple error
Дата
Msg-id 5097FD83.4000605@swoodbridge.com
обсуждение исходный текст
Ответ на Re: Problem with heap_form_tuple error  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Problem with heap_form_tuple error  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On 11/5/2012 10:34 AM, Tom Lane wrote:
> Stephen Woodbridge <woodbri@swoodbridge.com> writes:
>> I'm have a problem with heap_form_tuple error
>>      ERROR:  invalid memory alloc request size 1149502660
>> I've read through a ton of examples and read through the code and the
>> docs and I'm sure I'm doing something stupid but I'm not seeing it.
>
> Hm ... you're setting up arguments to heap_form_tuple like this:
>
>>               values[1] = CStringGetDatum(pstrdup(stdaddr->building));
>
> This is only correct if the corresponding column of the tupledesc is
> declared as being type "cstring", which I'm willing to bet it isn't.
> heap_form_tuple does not do any type conversion --- the datums provided
> have to be of the right types already.
>
> You could feed the string through the input function for the column's
> type, but perhaps what you really ought to do is use
> BuildTupleFromCStrings rather than using heap_form_tuple directly.
>
>             regards, tom lane
>
>
Hi Tom,

Thanks, changing my code to use BuildTupleFromCStrings did the trick. So
if I wanted to do some like my code was doing what is the proper way to
convert a CString into varchar and then that into Datum?

I tried to follow the source code for BuildTupleFromCStrings but it
rapidly got convoluted and was not easy to follow.

Thanks again for the help,
   -Steve


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

Предыдущее
От: RAJDEEP SARDAR
Дата:
Сообщение: Select Query Modification:Details needed
Следующее
От: Alan Hodgson
Дата:
Сообщение: Re: lock database share