postgres.git / summary / log / commit / refs
commit f71d803c8de8daa7219ea52366ad3f4ff9345b3f
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Thu Apr 12 22:39:51 2018 +0000
First released in: 11.0, 9.3.23, 9.4.18, 9.5.13, 9.6.9, 10.4
Fix bogus affix-merging code.
NISortAffixes() compared successive compound affixes incorrectly,
thus possibly failing to merge identical affixes, or (less likely)
merging ones that shouldn't be merged. The user-visible effects
of this are unclear, to me anyway.
Per bug #15150 from Alexander Lakhin. It's been broken for a long time,
so back-patch to all supported branches.
Arthur Zakirov
Discussion: https://postgr.es/m/152353327780.31225.13445405496721177988@wrigleys.postgresql.org
src/backend/tsearch/spell.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/backend/tsearch/spell.c b/src/backend/tsearch/spell.c
index 05a764bb83e..c7d0b714aab 100644
--- a/src/backend/tsearch/spell.c
+++ b/src/backend/tsearch/spell.c
@@ -1370,8 +1370,10 @@ NISortAffixes(IspellDict *Conf)
if ((Affix->flagflags & FF_COMPOUNDFLAG) && Affix->replen > 0 &&
isAffixInUse(Conf, (char) Affix->flag))
{
+ bool issuffix = (Affix->type == FF_SUFFIX);
+
if (ptr == Conf->CompoundAffix ||
- ptr->issuffix != (ptr - 1)->issuffix ||
+ issuffix != (ptr - 1)->issuffix ||
strbncmp((const unsigned char *) (ptr - 1)->affix,
(const unsigned char *) Affix->repl,
(ptr - 1)->len))
@@ -1379,7 +1381,7 @@ NISortAffixes(IspellDict *Conf)
/* leave only unique and minimals suffixes */
ptr->affix = Affix->repl;
ptr->len = Affix->replen;
- ptr->issuffix = (Affix->type == FF_SUFFIX) ? true : false;
+ ptr->issuffix = issuffix;
ptr++;
}
}
[parent: 6943fb9275a5]