summaryrefslogtreecommitdiff
path: root/contrib/pg_trgm
diff options
context:
space:
mode:
authorTom Lane2022-10-06 15:08:56 +0000
committerTom Lane2022-10-06 15:08:56 +0000
commitca71131eebba63809ceb86be033a264a5f0a1d79 (patch)
treebff861724e38a284e336b166f60ce6c341c69973 /contrib/pg_trgm
parent5757141caeaff4af0c206ab672d542cbd608542c (diff)
Introduce t_isalnum() to replace t_isalpha() || t_isdigit() tests.
ts_locale.c omitted support for "isalnum" tests, perhaps on the grounds that there were initially no use-cases for that. However, both ltree and pg_trgm need such tests, and we do also have one use-case now in the core backend. The workaround of testing isalpha and isdigit separately seems quite inefficient, especially when dealing with multibyte characters; so let's fill in the missing support. Discussion: https://postgr.es/m/2548310.1664999615@sss.pgh.pa.us
Diffstat (limited to 'contrib/pg_trgm')
-rw-r--r--contrib/pg_trgm/trgm.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/pg_trgm/trgm.h b/contrib/pg_trgm/trgm.h
index 405a1d95528..afb0adb222b 100644
--- a/contrib/pg_trgm/trgm.h
+++ b/contrib/pg_trgm/trgm.h
@@ -52,7 +52,7 @@ typedef char trgm[3];
} while(0)
#ifdef KEEPONLYALNUM
-#define ISWORDCHR(c) (t_isalpha(c) || t_isdigit(c))
+#define ISWORDCHR(c) (t_isalnum(c))
#define ISPRINTABLECHAR(a) ( isascii( *(unsigned char*)(a) ) && (isalnum( *(unsigned char*)(a) ) || *(unsigned char*)(a)==' ') )
#else
#define ISWORDCHR(c) (!t_isspace(c))