@@ -394,20 +394,6 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
394394
395395PG_TRY ();
396396{
397- /*
398- * If requested, create permanent slot for the subscription.
399- * We won't use the initial snapshot for anything, so no need
400- * to export it.
401- */
402- if (create_slot )
403- {
404- walrcv_create_slot (wrconn ,slotname , false,
405- CRS_NOEXPORT_SNAPSHOT ,& lsn );
406- ereport (NOTICE ,
407- (errmsg ("created replication slot \"%s\" on publisher" ,
408- slotname )));
409- }
410-
411397/*
412398 * Set sync state based on if we were asked to do data copy or
413399 * not.
@@ -432,6 +418,20 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
432418
433419ereport (NOTICE ,
434420(errmsg ("synchronized table states" )));
421+
422+ /*
423+ * If requested, create permanent slot for the subscription.
424+ * We won't use the initial snapshot for anything, so no need
425+ * to export it.
426+ */
427+ if (create_slot )
428+ {
429+ walrcv_create_slot (wrconn ,slotname , false,
430+ CRS_NOEXPORT_SNAPSHOT ,& lsn );
431+ ereport (NOTICE ,
432+ (errmsg ("created replication slot \"%s\" on publisher" ,
433+ slotname )));
434+ }
435435}
436436PG_CATCH ();
437437{