diff options
author | Tom Lane | 2011-04-23 18:13:09 +0000 |
---|---|---|
committer | Tom Lane | 2011-04-23 18:13:09 +0000 |
commit | a0b75a41a907e1582acdb8aa6ebb9cacca39d7d8 (patch) | |
tree | da7fff519f9118e5c42c577f9164e1b8bf2e2cb3 | |
parent | 1abd146dddc1dc5efff5ccac065c460108acbaa9 (diff) |
Hash indexes had better pass the index collation to support functions, too.
Per experimentation with contrib/citext, whose hash function assumes that
it'll be passed a collation.
-rw-r--r-- | src/backend/access/hash/hashutil.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/access/hash/hashutil.c b/src/backend/access/hash/hashutil.c index ac238d9f7d..6283f4a82b 100644 --- a/src/backend/access/hash/hashutil.c +++ b/src/backend/access/hash/hashutil.c @@ -80,11 +80,13 @@ uint32 _hash_datum2hashkey(Relation rel, Datum key) { FmgrInfo *procinfo; + Oid collation; /* XXX assumes index has only one attribute */ procinfo = index_getprocinfo(rel, 1, HASHPROC); + collation = rel->rd_indcollation[0]; - return DatumGetUInt32(FunctionCall1(procinfo, key)); + return DatumGetUInt32(FunctionCall1Coll(procinfo, collation, key)); } /* @@ -98,6 +100,7 @@ uint32 _hash_datum2hashkey_type(Relation rel, Datum key, Oid keytype) { RegProcedure hash_proc; + Oid collation; /* XXX assumes index has only one attribute */ hash_proc = get_opfamily_proc(rel->rd_opfamily[0], @@ -108,8 +111,9 @@ _hash_datum2hashkey_type(Relation rel, Datum key, Oid keytype) elog(ERROR, "missing support function %d(%u,%u) for index \"%s\"", HASHPROC, keytype, keytype, RelationGetRelationName(rel)); + collation = rel->rd_indcollation[0]; - return DatumGetUInt32(OidFunctionCall1(hash_proc, key)); + return DatumGetUInt32(OidFunctionCall1Coll(hash_proc, collation, key)); } /* |