diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index fd0fdb96d42..edd9f844f23 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -2332,7 +2332,7 @@ SaveSlotToPath(ReplicationSlot *slot, const char *dir, int elevel)
 	sprintf(tmppath, "%s/state.tmp", dir);
 	sprintf(path, "%s/state", dir);
 
-	fd = OpenTransientFile(tmppath, O_CREAT | O_EXCL | O_WRONLY | PG_BINARY);
+	fd = OpenTransientFile(tmppath, O_CREAT | O_TRUNC | O_WRONLY | PG_BINARY);
 	if (fd < 0)
 	{
 		/*
