Fix uninitialized cache use in gtsvector_picksplit() When a page split involves two entries, the seed selection loop does not run and the seeds default to entries 1 and 2. The cache of the last entry was filled only after the initial union keys were built from it, hence the right side of the union could be computed from memory that was not initialized. This could cause index scans to miss matching rows.
This issue is fixed by filling the cache of the last entry before forming the initial unions, by moving around a fillcache(). GiST indexes based on tsvector may need a REINDEX, if these are based on a single column. Issue spotted originally by valgrind. Reported-by: Alexander Lakhin <[email protected]> Author: Shihao Zhong <[email protected]> Reviewed-by: Michael Paquier <[email protected]> Discussion: https://postgr.es/m/[email protected] Backpatch-through: 15 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/1d657c6e013e152ed37b42a22ee9f291179ee50f Modified Files -------------- src/backend/utils/adt/tsgistidx.c | 6 ++++-- src/test/regress/expected/tsearch.out | 17 +++++++++++++++++ src/test/regress/sql/tsearch.sql | 13 +++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-)
