Skip to content

Commit 474ff21

Browse files
committed
De-kludge contrib/btree_gin for collations.
Using DEFAULT_COLLATION_OID in the comparePartial functions was not only a lame hack, but outright wrong, because the compare functions for collation-aware types were already responding to the declared index collation. So comparePartial would have the wrong expectation about the index's sort order, possibly leading to missing matches for prefix searches.
1 parent 78e7e20 commit 474ff21

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

contrib/btree_gin/btree_gin.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#include "fmgr.h"
99
#include "access/skey.h"
10-
#include "catalog/pg_collation.h"
1110
#include "utils/builtins.h"
1211
#include "utils/bytea.h"
1312
#include "utils/cash.h"
@@ -123,7 +122,7 @@ gin_compare_prefix_##type(PG_FUNCTION_ARGS) \
123122
\
124123
cmp = DatumGetInt32(DirectFunctionCall2Coll( \
125124
TypeInfo_##type.typecmp, \
126-
DEFAULT_COLLATION_OID, \
125+
PG_GET_COLLATION(), \
127126
(data->strategy == BTLessStrategyNumber || \
128127
data->strategy == BTLessEqualStrategyNumber) \
129128
? data->datum : a, \

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy