diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-04-12 18:39:51 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-04-12 18:39:51 -0400 |
commit | 65a69dfa08e212556d11e44a5a8a1861fd826ccd (patch) | |
tree | a6c7ce2d80d8bd0a2b910c362200578ee3776f99 /src | |
parent | b8ca984b2c739e096c08f260f477792495f4dfe4 (diff) | |
download | postgresql-65a69dfa08e212556d11e44a5a8a1861fd826ccd.tar.gz postgresql-65a69dfa08e212556d11e44a5a8a1861fd826ccd.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/tsearch/spell.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/tsearch/spell.c b/src/backend/tsearch/spell.c index b9fdd77e198..65d99da292a 100644 --- a/src/backend/tsearch/spell.c +++ b/src/backend/tsearch/spell.c @@ -1963,8 +1963,10 @@ NISortAffixes(IspellDict *Conf) if ((Affix->flagflags & FF_COMPOUNDFLAG) && Affix->replen > 0 && isAffixInUse(Conf, 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)) @@ -1972,7 +1974,7 @@ NISortAffixes(IspellDict *Conf) /* leave only unique and minimals suffixes */ ptr->affix = Affix->repl; ptr->len = Affix->replen; - ptr->issuffix = (Affix->type == FF_SUFFIX); + ptr->issuffix = issuffix; ptr++; } } |