]> git.ipfire.org Git - thirdparty/postgresql.git/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:52 +0000 (20:52 -0500)
commit5a74ff373c6af1fe0747555596d62b6156eeef3e
tree77fbc970d3da558b319be37a500542799e0897dd
parent3a3b7e316f85566771d3a28ea874e030fb12126b
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