pgsql: Use the proper comparator in gbt_bit_ssup_cmp.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use the proper comparator in gbt_bit_ssup_cmp.
Date: 2026-07-03 17:11:24
Message-ID: E1wfhQC-001Bzg-2B@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use the proper comparator in gbt_bit_ssup_cmp.

If we're dealing with leaf entries, the function to call is bitcmp
not byteacmp. Using byteacmp didn't lead to any obvious failure,
but it did result in sorting the entries in a way not matching the
datatype's actual sort order. Hence the constructed index would be
less efficient than one would expect, and in particular worse than
what you got before this code was added in v18 (by commit e4309f73f).

We might want to recommend that users reindex btree_gist indexes
on bit/varbit columns.

Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Reviewed-by: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Discussion: https://postgr.es/m/AH*AvQCYKhQGVvPWi1GiU4oY.8.1781609375063.Hmail.3020001251@tju.edu.cn
Backpatch-through: 18

Branch
------
master

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

Modified Files
--------------
contrib/btree_gist/btree_bit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2026-07-03 17:18:20 pgsql: Reverse-engineer some documentation for btree_gist's varlena mod
Previous Message Peter Eisentraut 2026-07-03 15:16:37 pgsql: Resolve unknown-type literals in GRAPH_TABLE COLUMNS