diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c
index 12dce2e2b43a8e4725aef59b4b553d270abb3e5f..c3f65af018d52c9bbd528e9dbbede745d2429638 100644
--- a/src/backend/access/hash/hashfunc.c
+++ b/src/backend/access/hash/hashfunc.c
@@ -134,11 +134,8 @@ Datum
 hashname(PG_FUNCTION_ARGS)
 {
 	char	   *key = NameStr(*PG_GETARG_NAME(0));
-	int			keylen = strlen(key);
 
-	Assert(keylen < NAMEDATALEN);		/* else it's not truncated correctly */
-
-	return hash_any((unsigned char *) key, keylen);
+	return hash_any((unsigned char *) key, strlen(key));
 }
 
 Datum