diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index 33b85d86cc..d56f1b76bc 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -173,7 +173,7 @@ ReplicationSlotValidateName(const char *name, int elevel)
 {
 	const char *cp;
 
-	if (strlen(name) == 0)
+	if (name[0] == '\0')
 	{
 		ereport(elevel,
 				(errcode(ERRCODE_INVALID_NAME),
