postgres.git / summary / log / commit / refs
commit 558c4ea9a43b27d4ddb702fc455cf641d3792cde
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Fri Jul 03 17:11:14 2026 +0000
First released in: 18.6, 19.0
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@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
Backpatch-through: 18
contrib/btree_gist/btree_bit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/btree_gist/btree_bit.c b/contrib/btree_gist/btree_bit.c
index 0df2ae20d8b..a8f2636c638 100644
--- a/contrib/btree_gist/btree_bit.c
+++ b/contrib/btree_gist/btree_bit.c
@@ -215,7 +215,7 @@ gbt_bit_ssup_cmp(Datum x, Datum y, SortSupport ssup)
Datum result;
/* for leaf items we expect lower == upper, so only compare lower */
- result = DirectFunctionCall2(byteacmp,
+ result = DirectFunctionCall2(bitcmp,
PointerGetDatum(arg1.lower),
PointerGetDatum(arg2.lower));
[parent: 3aaefe8924f4]