summaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gistsplit.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-02-07 19:14:22 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2013-02-07 19:14:22 -0500
commit77b9bac3be0f4ca81f8daef108890fb993f1cab6 (patch)
tree41946cbdbc5c62973cec8a2bc0c42f82c1dcde0a /src/backend/access/gist/gistsplit.c
parentf27cbcdc6b30c47c24e28c38a3d4164ec03a0df5 (diff)
Make contrib/btree_gist's GiST penalty function a bit saner.
The previous coding supposed that the first differing bytes in two varlena datums must have the same sign difference as their overall comparison result. This is obviously bogus for text strings in non-C locales, and probably wrong for numeric, and even for bytea I think it was wrong on machines where char is signed. When the assumption failed, the function could deliver a zero or negative penalty in situations where such a result is quite ridiculous, leading the core GiST code to make very bad page-split decisions. To fix, take the absolute values of the byte-level differences. Also, switch the code to using unsigned char not just char, so that the behavior will be consistent whether char is signed or not. Per investigation of a trouble report from Tomas Vondra. Back-patch to all supported branches.
Diffstat (limited to 'src/backend/access/gist/gistsplit.c')
0 files changed, 0 insertions, 0 deletions