Fulltextindex

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Fulltextindex
Date: 2002-08-30 06:42:15
Message-ID: GNELIHDDFBOCMGBFGEFOGEPICDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 executing plan in insert\n");

cur_pos--;
}

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-08-30 06:52:16 Re: RULE regression test failure
Previous Message Gavin Sherry 2002-08-30 06:37:53 Re: RULE regression test failure