Re: [HACKERS] bug of pg_trgm?

2012-09-06 Thread Andrew Dunstan
On 08/20/2012 01:26 PM, Tom Lane wrote: Fujii Masao masao.fu...@gmail.com writes: OK. Attached patch fixes the problem as you suggested, i.e., it backs up endword if the second loop exits in an escape pair. Applied with a bit of further adjustment of the comments. Thanks!

Re: [HACKERS] bug of pg_trgm?

2012-09-06 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes: On 08/20/2012 01:26 PM, Tom Lane wrote: Fujii Masao masao.fu...@gmail.com writes: OK. Attached patch fixes the problem as you suggested, i.e., it backs up endword if the second loop exits in an escape pair. Applied with a bit of further adjustment

Re: [HACKERS] bug of pg_trgm?

2012-09-06 Thread Andrew Dunstan
On 09/06/2012 05:09 PM, Tom Lane wrote: Andrew Dunstan and...@dunslane.net writes: On 08/20/2012 01:26 PM, Tom Lane wrote: Fujii Masao masao.fu...@gmail.com writes: OK. Attached patch fixes the problem as you suggested, i.e., it backs up endword if the second loop exits in an escape pair.

Re: [HACKERS] bug of pg_trgm?

2012-08-20 Thread Fujii Masao
On Sat, Aug 11, 2012 at 8:15 AM, Tom Lane t...@sss.pgh.pa.us wrote: Fujii Masao masao.fu...@gmail.com writes: No. ISTM that in_wildcard_meta must be reset before the second loop. Because the meaning of that flag in the first loop is different from that in the second loop. The former and the

Re: [HACKERS] bug of pg_trgm?

2012-08-20 Thread Tom Lane
Fujii Masao masao.fu...@gmail.com writes: OK. Attached patch fixes the problem as you suggested, i.e., it backs up endword if the second loop exits in an escape pair. Applied with a bit of further adjustment of the comments. Thanks! regards, tom lane -- Sent via

Re: [HACKERS] bug of pg_trgm?

2012-08-10 Thread Fujii Masao
On Thu, Aug 9, 2012 at 2:28 AM, Tom Lane t...@sss.pgh.pa.us wrote: Fujii Masao masao.fu...@gmail.com writes: When I used pg_trgm, I encountered the problem that the search result of SeqScan was the different from that of BitmapScan even if the search keyword was the same. Is this a bug?

Re: [HACKERS] bug of pg_trgm?

2012-08-10 Thread Fujii Masao
On Thu, Aug 9, 2012 at 3:05 AM, Tom Lane t...@sss.pgh.pa.us wrote: ... btw, I think there is another problem here, which is that generate_wildcard_trgm will restart get_wildcard_part at the same place that the second loop exits, which means it would do the wrong thing if what it returns is a

Re: [HACKERS] bug of pg_trgm?

2012-08-10 Thread Tom Lane
Fujii Masao masao.fu...@gmail.com writes: On Thu, Aug 9, 2012 at 2:28 AM, Tom Lane t...@sss.pgh.pa.us wrote: I'm also inclined to think that we should remove *both* flag resets before the second loop. The logic here is that we are reprocessing the same character seen in the last iteration of

Re: [HACKERS] bug of pg_trgm?

2012-08-10 Thread Tom Lane
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

Re: [HACKERS] bug of pg_trgm?

2012-08-08 Thread Tom Lane
Fujii Masao masao.fu...@gmail.com writes: When I used pg_trgm, I encountered the problem that the search result of SeqScan was the different from that of BitmapScan even if the search keyword was the same. Is this a bug? Surely. The cause is ISTM that pg_trgm wrongly ignores the heading

Re: [HACKERS] bug of pg_trgm?

2012-08-08 Thread Tom Lane
... btw, I think there is another problem here, which is that generate_wildcard_trgm will restart get_wildcard_part at the same place that the second loop exits, which means it would do the wrong thing if what it returns is a pointer to the second char of an escape pair. Consider for instance