agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove btree_gist's useless logic for encoding-aware truncation.
Date: Fri, 03 Jul 2026 19:32:02 +0000
Message-ID: <E1wfjcJ-001Ctu-0R@gemulon.postgresql.org> (raw)

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b82d69abf64fc0c2fc6fdd491d7cecb8244680c2

Modified Files
--------------
contrib/btree_gist/btree_bit.c       |  1 -
contrib/btree_gist/btree_bytea.c     |  1 -
contrib/btree_gist/btree_numeric.c   |  1 -
contrib/btree_gist/btree_text.c      | 21 ++------------------
contrib/btree_gist/btree_utils_var.c | 37 ++++++------------------------------
contrib/btree_gist/btree_utils_var.h |  2 --
6 files changed, 8 insertions(+), 55 deletions(-)



Message-ID: <E1wfjcJ-001Ctu-0R@gemulon.postgresql.org>
Permalink:  ../E1wfjcJ-001Ctu-0R@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wfjcJ-001Ctu-0R@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Remove btree_gist's useless logic for encoding-aware truncation.
  In-Reply-To: <E1wfjcJ-001Ctu-0R@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox