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


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to