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 <[email protected]> Reviewed-by: Ayush Tiwari <[email protected]> Discussion: https://postgr.es/m/AH*avqcykhqgvvpwi1giu4oy.8.1781609375063.hmail.3020001...@tju.edu.cn Backpatch-through: 18 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/11cb9c431127ad0f331b1bf884f5c646f70b3c4f Modified Files -------------- contrib/btree_gist/btree_bit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
