Fulltextindex - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Fulltextindex
Date
Msg-id GNELIHDDFBOCMGBFGEFOGEPICDAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to Re: RULE regression test failure  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Fulltextindex  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
An aside.

In the fulltextindex code I'm trying to figure out what's breaking the
attached code segment.

Basically the data->vl_len line causes a segfault on the second time thru
the while loop.  I can't figure it out.  I can't write to the value, but
why?  Basically with a word like 'john', it is inserting 'hn', then 'ohn'
and then 'john' into the database.

Thanks for any help for me getting this in for the beta!

Chris
-------------------------------------

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 */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--;
}



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: RULE regression test failure
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: RULE regression test failure