Re: making tsearch2 dictionaries

Поиск
Список
Период
Сортировка
От Teodor Sigaev
Тема Re: making tsearch2 dictionaries
Дата
Msg-id 4030FD27.2070902@sigaev.ru
обсуждение исходный текст
Ответ на Re: making tsearch2 dictionaries  (Ben <bench@silentmedia.com>)
Ответы Re: making tsearch2 dictionaries
Список pgsql-general

Ben wrote:
> Thanks for the replies. Just to clarify what I was doing, quaicode
> looked something like:
>
> phrase = palloc(8);
> phrase = "foo\0bar\0";
> res = palloc(3);
> res[0] = phrase[0];
> res[1] = phrase[5];
> res[2] = 0;
>
> That crashed. Once I changed it to:
>
> res = palloc(3);
> res[0] = palloc(4);
> res[0] = "foo\0";
> res[1] = palloc(4);
> res[2] = "bar\0";
> res[3] = 0;
>
> it worked.
>
:)
I hope you mean:
res = palloc(3);
res[0] = palloc(4);
memcpy(res[0] ,"foo", 4);
res[1] = palloc(4);
memcpy(res[1] ,"bar", 4);
res[2] = 0;

Look at indexes of res.

--
Teodor Sigaev                                  E-mail: teodor@sigaev.ru

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PGSQL C API()
Следующее
От: Teodor Sigaev
Дата:
Сообщение: Re: making tsearch2 dictionaries