]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Remove btree_gist's useless logic for encoding-aware truncation.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 3 Jul 2026 19:31:58 +0000 (15:31 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 3 Jul 2026 19:31:58 +0000 (15:31 -0400)
commitb82d69abf64fc0c2fc6fdd491d7cecb8244680c2
treedaf21e4e0083f4a2aaea6d6674049ba631a25798
parentfea9c1884b2009a94287989e961d6493e22bf656
Remove btree_gist's useless logic for encoding-aware truncation.

gbt_var_node_cp_len() contained logic to ensure that its choice of
a common prefix length didn't truncate away part of a multibyte
character.  However, that was really dead code, because we have not
allowed truncation of text-string data types since ef770cbb6, and
it seems unlikely that that behavior could ever get resurrected.
The code is still reachable via gbt_var_penalty, but for that
usage it hardly matters if we break in the middle of a multibyte
character: we're just calculating a small correction factor that
is arguably bunkum anyway in non-C locales.

Hence, delete said code.  That actually removes all need for
gbtree_vinfo.eml, which allows const-ification of the gbtree_vinfo
structs in which we were changing it, which removes one headache
for future attempts to thread-ify the backend.

(Curiously, all this infrastructure was itself added by ef770cbb6.
Not sure why Teodor didn't see the contradiction.)

Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Discussion: https://postgr.es/m/AH*AvQCYKhQGVvPWi1GiU4oY.8.1781609375063.Hmail.3020001251@tju.edu.cn
contrib/btree_gist/btree_bit.c
contrib/btree_gist/btree_bytea.c
contrib/btree_gist/btree_numeric.c
contrib/btree_gist/btree_text.c
contrib/btree_gist/btree_utils_var.c
contrib/btree_gist/btree_utils_var.h