Re: C function to create tsquery not working - Mailing list pgsql-general

From Pavel Stehule
Subject Re: C function to create tsquery not working
Date
Msg-id 162867791002250241q6703f8cbhf98980abd87845dc@mail.gmail.com
Whole thread Raw
In response to Re: C function to create tsquery not working  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
Responses Re: C function to create tsquery not working  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
List pgsql-general
2010/2/25 Ivan Sergio Borgonovo <mail@webthatworks.it>:
> On Thu, 11 Feb 2010 20:11:54 +0100
> Ivan Sergio Borgonovo <mail@webthatworks.it> wrote:
>
>> I'm still having trouble making this work:
>>
>> http://pgsql.privatepaste.com/14a6d3075e
>
> I tried to play with
> item->operator.left
> to see if reshuffling the expression could make any difference.
> item->operator.left = 2 * lexeme - 2 (1 + i)
> or
> item->operator.left = lexemes
>
> But the result seems pretty indifferent to what I put in
> operator.left.
> That makes me think the error is here.
>
> But I still get those 2 kind of error:
> ERROR:  unrecognized operator type: 50 (first run)
> or
> ERROR:  stack depth limit exceeded
>
> Just at the 3rd returned row, just for certain queries (see previous
> email).
>
> It doesn't look as if I palloced too few memory, I tried to allocate
> 3x the memory I estimated and I still get the errors.
>
> The function is actually returning correct results, so it seems the
> tsquery object is well formed.
>
> But still it looks like infix() is trying to read more operators
> than the one I thought I've put in... but just for certain queries,
> and just at the 3rd row returned.
>
> Should I use something different than palloc? Should I return the
> query differently? Am I supposed to free something?

use --enable-assert configure flag?

you can use memory in bad context. So you are alloc good memory, but
when you leave function, then complete memory context is freeed and
you can have a problem.

Regards
Pavel Stehule


>
>
> --
> Ivan Sergio Borgonovo
> http://www.webthatworks.it
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

pgsql-general by date:

Previous
From: Ivan Sergio Borgonovo
Date:
Subject: Re: C function to create tsquery not working
Next
From: Carsten Kropf
Date:
Subject: Putting index entries to XLog