Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/catalog/namespace.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
index eecc50a958d..b610aa62423 100644
--- a/src/backend/catalog/namespace.c
+++ b/src/backend/catalog/namespace.c
@@ -41,7 +41,7 @@
#include "catalog/pg_ts_template.h"
#include "catalog/pg_type.h"
#include "commands/dbcommands.h"
-#include "common/hashfn.h"
+#include "common/hashfn_unstable.h"
#include "funcapi.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
@@ -253,11 +253,21 @@ static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames,
static inline uint32
spcachekey_hash(SearchPathCacheKey key)
{
- const unsigned char *bytes = (const unsigned char *) key.searchPath;
- int blen = strlen(key.searchPath);
+ fasthash_state hs;
+ int sp_len;
- return hash_combine(hash_bytes(bytes, blen),
- hash_uint32(key.roleid));
+ fasthash_init(&hs, FH_UNKNOWN_LENGTH, 0);
+
+ hs.accum = key.roleid;
+ fasthash_combine(&hs);
+
+ /*
+ * Combine search path into the hash and save the length for tweaking the
+ * final mix.
+ */
+ sp_len = fasthash_accum_cstring(&hs, key.searchPath);
+
+ return fasthash_final32(&hs, sp_len);
}
static inline bool