Fujii Masao <masao.fu...@gmail.com> writes: > On Thu, Aug 9, 2012 at 3:05 AM, Tom Lane <t...@sss.pgh.pa.us> wrote: >> Probably a minimal fix for this could be made by backing up "endword" >> one byte before returning it if in_escape is true when the second >> loop exits. That would not scale up to preserving the state of >> in_wildcard_meta, but since the second loop never advances past a >> meta char, that's okay for the moment.
> Or what about extending get_wildcard_part() so that it accepts the pointer > to in_escape as an argument? generate_wildcard_trgm() can know the last > value of in_escape and specify it the next call of get_wildcard_part(). Looks > very simple. Yeah, I had considered pushing the state variables out to the caller. If there were any prospect of wanting more state than just in_escape, I'd be for that --- but I don't see any reason to possibly need more, especially in view of your point that in_wildcard_meta isn't really a single flag with an interpretation that remains fixed throughout. I think it's probably better just to take care of the issue inside get_wildcard_part, and not complicate its API. regards, tom lane - Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers