@@ -1061,9 +1061,25 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
10611061 ReplicationSlotCreate (cmd -> slotname , false,
10621062 cmd -> temporary ? RS_TEMPORARY : RS_PERSISTENT ,
10631063 false);
1064+
1065+ if (reserve_wal )
1066+ {
1067+ ReplicationSlotReserveWal ();
1068+
1069+ ReplicationSlotMarkDirty ();
1070+
1071+ /* Write this slot to disk if it's a permanent one. */
1072+ if (!cmd -> temporary )
1073+ ReplicationSlotSave ();
1074+ }
10641075 }
10651076 else
10661077 {
1078+ LogicalDecodingContext * ctx ;
1079+ bool need_full_snapshot = false;
1080+
1081+ Assert (cmd -> kind == REPLICATION_KIND_LOGICAL );
1082+
10671083 CheckLogicalDecodingRequirements ();
10681084
10691085 /*
@@ -1076,12 +1092,6 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
10761092 ReplicationSlotCreate (cmd -> slotname , true,
10771093 cmd -> temporary ? RS_TEMPORARY : RS_EPHEMERAL ,
10781094 two_phase );
1079- }
1080-
1081- if (cmd -> kind == REPLICATION_KIND_LOGICAL )
1082- {
1083- LogicalDecodingContext * ctx ;
1084- bool need_full_snapshot = false;
10851095
10861096 /*
10871097 * Do options check early so that we can bail before calling the
@@ -1175,16 +1185,6 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
11751185 if (!cmd -> temporary )
11761186 ReplicationSlotPersist ();
11771187 }
1178- else if (cmd -> kind == REPLICATION_KIND_PHYSICAL && reserve_wal )
1179- {
1180- ReplicationSlotReserveWal ();
1181-
1182- ReplicationSlotMarkDirty ();
1183-
1184- /* Write this slot to disk if it's a permanent one. */
1185- if (!cmd -> temporary )
1186- ReplicationSlotSave ();
1187- }
11881188
11891189 snprintf (xloc , sizeof (xloc ), "%X/%X" ,
11901190 LSN_FORMAT_ARGS (MyReplicationSlot -> data .confirmed_flush ));
0 commit comments