replslot_state_tmp_otrunc.patch

application/octet-stream

Filename: replslot_state_tmp_otrunc.patch
Type: application/octet-stream
Part: 0
Message: Replace O_EXCL with O_TRUNC for creation of state.tmp in SaveSlotToPath

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/backend/replication/slot.c 1 1
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)
 	{
 		/*