postgresql/contrib/pg_trgm
Tom Lane 7844608e54 Get rid of USE_WIDE_UPPER_LOWER dependency in trigram construction.
contrib/pg_trgm's make_trigrams() was coded to ignore multibyte character
boundaries and just make trigrams from bytes if USE_WIDE_UPPER_LOWER wasn't
defined.  This is a bit odd, since there's no obvious reason why trigram
compaction rules should depend on the presence of towlower() and friends.
What's more, there was an Assert() that would fail if that code path was
fed any multibyte characters.

We need to do something about this since the pending regex-indexing patch
has an assumption that you get just one "trgm" from any three characters.
The best solution seems to be to remove the USE_WIDE_UPPER_LOWER
dependency, which shouldn't really have been there in the first place.
The second loop in make_trigrams() is now just a fast path and not a
potentially incompatible algorithm.

If there is anybody still using Postgres on machines without wcstombs() or
towlower(), and they have non-ASCII data indexed by pg_trgm, they'll need
to REINDEX those indexes after pg_upgrade to 9.3, else searches may fail
incorrectly. It seems likely that there are no such installations, though.

In passing, rename cnt_trigram to compact_trigram, which seems to better
describe its functionality, and improve make_trigrams' test for whether it
has to use the slow path or not (per a suggestion from Alexander Korotkov).
2013-04-07 14:46:17 -04:00
..
data
expected Fix contrib/pg_trgm's similarity() function for trigram-free strings. 2013-02-13 14:07:06 -05:00
sql Fix contrib/pg_trgm's similarity() function for trigram-free strings. 2013-02-13 14:07:06 -05:00
.gitignore Support "make check" in contrib 2011-04-25 22:27:11 +03:00
Makefile Convert contrib modules to use the extension facility. 2011-02-13 22:54:49 -05:00
pg_trgm--1.0.sql Throw a useful error message if an extension script file is fed to psql. 2011-10-12 15:45:03 -04:00
pg_trgm--unpackaged--1.0.sql Throw a useful error message if an extension script file is fed to psql. 2011-10-12 15:45:03 -04:00
pg_trgm.control Convert contrib modules to use the extension facility. 2011-02-13 22:54:49 -05:00
trgm_gin.c Remove unnecessary #include references, per pgrminclude script. 2011-09-01 10:04:27 -04:00
trgm_gist.c Replace int2/int4 in C code with int16/int32 2012-06-25 01:51:46 +03:00
trgm_op.c Get rid of USE_WIDE_UPPER_LOWER dependency in trigram construction. 2013-04-07 14:46:17 -04:00
trgm.h Remove many -Wcast-qual warnings 2011-09-11 21:54:32 +03:00