Skip to content

Commit d0c8cf2

Browse files
committed
Add a caveat to hash_seq_init_with_hash_value() header comment
The typical use-case for hash_seq_init_with_hash_value() is syscache callback. Add a caveat that the default hash function doesn't match syscache hash function. So, one needs to define a custom hash function. Reported-by: Pavel Stehule Discussion: https://postgr.es/m/CAFj8pRAXmv6eyYx%3DE_BTfyK%3DO_%2ByOF8sXB%3D0bn9eOBt90EgWRA%40mail.gmail.com Reviewed-by: Pavel Stehule
1 parent 49dc191 commit d0c8cf2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/backend/utils/hash/dynahash.c

+5
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,11 @@ hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
13951395
/*
13961396
* Same as above but scan by the given hash value.
13971397
* See also hash_seq_search().
1398+
*
1399+
* NOTE: the default hash function doesn't match syscache hash function.
1400+
* Thus, if you're going to use this function in syscache callback, make sure
1401+
* you're using custom hash function. See relatt_cache_syshash()
1402+
* for example.
13981403
*/
13991404
void
14001405
hash_seq_init_with_hash_value(HASH_SEQ_STATUS *status, HTAB *hashp,

0 commit comments

Comments
 (0)