]> granicus.if.org Git - postgresql/commit
Cope with more than 64K phrases in a thesaurus dictionary.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 7 Nov 2014 01:52:40 +0000 (20:52 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 7 Nov 2014 01:52:40 +0000 (20:52 -0500)
commitd6e37b35cda9a88dfd938dd61e9986dd93cc6dd3
treeddbc928427854eaedaf6fb8efed5f9c6144e701d
parent4875931938b27924fe8d6f91bbdb09e2e5a29d0a
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.
src/backend/tsearch/dict_thesaurus.c