Hacker, I found two issues in fuzzystrmatch contrib. 1) Incorrect s_data shift in levenshtein calculation with threshold with multibyte characters. "i" index was used instead of "start_column". 2) Missing dependency of fuzzystrmatch.o on levenshtein.c
Patch is attached. ------ With best regards, Alexander Korotkov.
*** a/contrib/fuzzystrmatch/Makefile --- b/contrib/fuzzystrmatch/Makefile *************** *** 16,18 **** top_builddir = ../.. --- 16,21 ---- include $(top_builddir)/src/Makefile.global include $(top_srcdir)/contrib/contrib-global.mk endif + + fuzzystrmatch.o: fuzzystrmatch.c levenshtein.c + *** a/contrib/fuzzystrmatch/levenshtein.c --- b/contrib/fuzzystrmatch/levenshtein.c *************** *** 377,383 **** levenshtein_internal(text *s, text *t, prev[start_column] = max_d + 1; curr[start_column] = max_d + 1; if (start_column != 0) ! s_data += s_char_len != NULL ? s_char_len[i - 1] : 1; start_column++; } --- 377,383 ---- prev[start_column] = max_d + 1; curr[start_column] = max_d + 1; if (start_column != 0) ! s_data += s_char_len != NULL ? s_char_len[start_column - 1] : 1; start_column++; }
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers