Re: Fulltextindex

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: Fulltextindex
Дата
Msg-id GNELIHDDFBOCMGBFGEFOMEPJCDAA.chriskl@familyhealth.com.au
обсуждение исходный текст
Ответ на Re: Fulltextindex  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Fulltextindex
Re: Fulltextindex
Список pgsql-hackers
OK, I was probably a little aggressive in my pruning...BTW, this code was
not written by me...

--------------------------------

struct varlena *data;
char    *word           = "john";
char    *cur_pos        = NULL;
int     cur_pos_length  = 0;

data = (struct varlena *) palloc(VARHDRSZ + column_length + 1);
word_length = strlen(word);
cur_pos = &word[word_length - 2];

while(cur_pos > word)
{cur_pos_length = strlen(cur_pos);/* Line below causes seg fault on SECOND iteration */data->vl_len = cur_pos_length +
sizeof(int32);memcpy(VARDATA(data),cur_pos, cur_pos_length);values[0] = PointerGetDatum(data);values[1] = 0;values[2] =
oid;
ret = SPI_execp(*(plan->splan), values, NULL, 0);if(ret != SPI_OK_INSERT)    elog(ERROR, "Full Text Indexing: error
executingplan in insert\n");
 
cur_pos--;
}

> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: Friday, 30 August 2002 2:53 PM
> To: Christopher Kings-Lynne
> Cc: Hackers
> Subject: Re: Fulltextindex
>
>
> "Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> > struct varlena *data;
> > char    *word           = NULL;
> > char    *cur_pos        = NULL;
> > int     cur_pos_length  = 0;
>
> > data = (struct varlena *) palloc(column_length);
>
> > while(cur_pos > word)
> > {
> >     cur_pos_length = strlen(cur_pos);
> >     /* Line below causes seg fault on SECOND iteration */
>
> You are not telling the whole truth here, as the above code excerpt
> will obviously never iterate the WHILE even once.  "NULL > NULL" is
> false in every C I ever heard of.
>
> Also, how much is column_length and how does it relate to the amount
> of data being copied into *data ?
>
>             regards, tom lane
>



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

Предыдущее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: Re: RULE regression test failure
Следующее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: DROP COLUMN & TOASTED DATA