postgresql/src/backend/tsearch
Tom Lane 0766880841 Cope with more than 64K phrases in a thesaurus dictionary.
dict_thesaurus stored phrase IDs in uint16 fields, so it would get confused
and even crash if there were more than 64K entries in the configuration
file.  It turns out to be basically free to widen the phrase IDs to uint32,
so let's just do so.

This was complained of some time ago by David Boutin (in bug #7793);
he later submitted an informal patch but it was never acted on.
We now have another complaint (bug #11901 from Luc Ouellette) so it's
time to make something happen.

This is basically Boutin's patch, but for future-proofing I also added a
defense against too many words per phrase.  Note that we don't need any
explicit defense against overflow of the uint32 counters, since before that
happens we'd hit array allocation sizes that repalloc rejects.

Back-patch to all supported branches because of the crash risk.
2014-11-06 20:53:02 -05:00
..
dict.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
dict_ispell.c Avoid memcpy() with same source and destination address. 2014-03-07 13:29:47 +02:00
dict_simple.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
dict_synonym.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
dict_thesaurus.c Cope with more than 64K phrases in a thesaurus dictionary. 2014-11-06 20:53:02 -05:00
hunspell_sample.affix Add regression tests for ispell, synonym and thesaurus dictionaries. 2007-09-11 11:54:42 +00:00
ispell_sample.affix Add regression tests for ispell, synonym and thesaurus dictionaries. 2007-09-11 11:54:42 +00:00
ispell_sample.dict Add regression tests for ispell, synonym and thesaurus dictionaries. 2007-09-11 11:54:42 +00:00
Makefile Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
regis.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
spell.c Improve ispell dictionary's defenses against bad affix files. 2014-10-23 13:11:41 -04:00
synonym_sample.syn Add prefix support for synonym dictionary 2009-08-14 14:53:20 +00:00
thesaurus_sample.ths Remove extra newlines at end and beginning of files, add missing newlines 2010-08-19 05:57:36 +00:00
to_tsany.c Use memmove() instead of memcpy() for copying overlapping regions. 2014-02-10 10:00:23 +02:00
ts_locale.c Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
ts_parse.c Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
ts_selfuncs.c Fix logical errors in tsquery selectivity estimation for prefix queries. 2012-09-11 21:23:49 -04:00
ts_typanalyze.c Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
ts_utils.c Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
wparser.c Pass collations to functions in FunctionCallInfoData, not FmgrInfo. 2011-04-12 19:19:24 -04:00
wparser_def.c Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00