Re: pg_trgm - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: pg_trgm
Date
Msg-id 20100527.233907.28787479.t-ishii@sraoss.co.jp
Whole thread Raw
In response to Re: pg_trgm  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_trgm
List pgsql-hackers
> Well, that doesn't mean that the answer is to use C locale ;-)

Of course it's up to user whether to use C locale or not. I just want
pg_trgm work with C locale as well.

> However, you could possibly think about making this bit of code
> more flexible:
> 
> #ifdef KEEPONLYALNUM
> #define iswordchr(c)    (t_isalpha(c) || t_isdigit(c))
> #else
> #define iswordchr(c)    (!t_isspace(c))
> #endif
> 
> Currently it seems to be hard-wired to the first case in standard
> builds.

Yup. Here is the patch in my mind:

*** trgm_op.c~    2009-06-11 23:48:51.000000000 +0900
--- trgm_op.c    2010-05-27 23:38:20.000000000 +0900
***************
*** 59,65 **** }  #ifdef KEEPONLYALNUM
! #define iswordchr(c)    (t_isalpha(c) || t_isdigit(c)) #else #define iswordchr(c)    (!t_isspace(c)) #endif
--- 59,65 ---- }  #ifdef KEEPONLYALNUM
! #define iswordchr(c)    (t_isalpha(c) || t_isdigit(c) || (lc_ctype_is_c() && !t_isspace(c))) #else #define
iswordchr(c)   (!t_isspace(c)) #endif
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_trgm
Next
From: Tom Lane
Date:
Subject: Re: pg_trgm