mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-10 12:19:32 +02:00
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. |
||
---|---|---|
.. | ||
data | ||
expected | ||
sql | ||
.gitignore | ||
btree_bit.c | ||
btree_bytea.c | ||
btree_cash.c | ||
btree_date.c | ||
btree_float4.c | ||
btree_float8.c | ||
btree_gist--1.0.sql | ||
btree_gist--unpackaged--1.0.sql | ||
btree_gist.c | ||
btree_gist.control | ||
btree_gist.h | ||
btree_inet.c | ||
btree_int2.c | ||
btree_int4.c | ||
btree_int8.c | ||
btree_interval.c | ||
btree_macaddr.c | ||
btree_numeric.c | ||
btree_oid.c | ||
btree_text.c | ||
btree_time.c | ||
btree_ts.c | ||
btree_utils_num.c | ||
btree_utils_num.h | ||
btree_utils_var.c | ||
btree_utils_var.h | ||
Makefile |