aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/pg_basebackup/pg_recvlogical.c9
-rw-r--r--src/bin/pg_basebackup/t/030_pg_recvlogical.pl8
2 files changed, 14 insertions, 3 deletions
diff --git a/src/bin/pg_basebackup/pg_recvlogical.c b/src/bin/pg_basebackup/pg_recvlogical.c
index b9ea23e1426..a3447753119 100644
--- a/src/bin/pg_basebackup/pg_recvlogical.c
+++ b/src/bin/pg_basebackup/pg_recvlogical.c
@@ -944,13 +944,16 @@ main(int argc, char **argv)
#endif
/*
- * Run IDENTIFY_SYSTEM to make sure we connected using a database specific
- * replication connection.
+ * Run IDENTIFY_SYSTEM to check the connection type for each action.
+ * --create-slot and --start actions require a database-specific
+ * replication connection because they handle logical replication slots.
+ * --drop-slot can remove replication slots from any replication
+ * connection without this restriction.
*/
if (!RunIdentifySystem(conn, NULL, NULL, NULL, &db_name))
exit(1);
- if (db_name == NULL)
+ if (!do_drop_slot && db_name == NULL)
pg_fatal("could not establish database-specific replication connection");
/*
diff --git a/src/bin/pg_basebackup/t/030_pg_recvlogical.pl b/src/bin/pg_basebackup/t/030_pg_recvlogical.pl
index a6e10600161..62bbc5a3f98 100644
--- a/src/bin/pg_basebackup/t/030_pg_recvlogical.pl
+++ b/src/bin/pg_basebackup/t/030_pg_recvlogical.pl
@@ -127,4 +127,12 @@ $node->command_ok(
],
'replayed a two-phase transaction');
+$node->command_ok(
+ [
+ 'pg_recvlogical',
+ '--slot' => 'test',
+ '--drop-slot'
+ ],
+ 'drop could work without dbname');
+
done_testing();