From e88c53b124ff61881914443f712d1d8c8b56d0ae Mon Sep 17 00:00:00 2001
From: Jakub Wartak <jakub.wartak@enterprisedb.com>
Date: Thu, 30 Jul 2026 11:02:13 +0200
Subject: [PATCH v06082026 01/10] pg_basebackup: rename the "blackhole" backup
 target to "server-blackhole"

The built-in "blackhole" backup target discards the backup on the server
side.  Rename it to "server-blackhole" to make the location of the discard
explicit and to leave room for a "client-blackhole" in the follow-up
commit.

Author: Jakub Wartak <jakub.wartak@enterprisedb.com>
---
 doc/src/sgml/protocol.sgml                   |  2 +-
 doc/src/sgml/ref/pg_basebackup.sgml          |  6 +++---
 src/backend/backup/basebackup_target.c       |  4 ++--
 src/bin/pg_basebackup/t/010_pg_basebackup.pl | 12 ++++++------
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 49f81676712..f5d4cf4440a 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -3174,7 +3174,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;"
            sent to the client. If it is <literal>server</literal>, the backup
            data is written to the server at the pathname specified by the
            <literal>TARGET_DETAIL</literal> option. If it is
-           <literal>blackhole</literal>, the backup data is not sent
+           <literal>server-blackhole</literal>, the backup data is not sent
            anywhere; it is simply discarded.
           </para>
 
diff --git a/doc/src/sgml/ref/pg_basebackup.sgml b/doc/src/sgml/ref/pg_basebackup.sgml
index fecee08b0a5..2ed643f005a 100644
--- a/doc/src/sgml/ref/pg_basebackup.sgml
+++ b/doc/src/sgml/ref/pg_basebackup.sgml
@@ -268,9 +268,9 @@ PostgreSQL documentation
         <literal>/some/path</literal> directory. Storing a backup on the
         server requires superuser privileges or having privileges of the
         <literal>pg_write_server_files</literal> role. If the target is set to
-        <literal>blackhole</literal>, the contents are discarded and not
-        stored anywhere. This should only be used for testing purposes, as you
-        will not end up with an actual backup.
+        <literal>server-blackhole</literal>, the contents are discarded by the
+        server and not stored anywhere. This should only be used for testing
+        purposes, as you will not end up with an actual backup.
        </para>
 
        <para>
diff --git a/src/backend/backup/basebackup_target.c b/src/backend/backup/basebackup_target.c
index 1c250d2895c..61465458638 100644
--- a/src/backend/backup/basebackup_target.c
+++ b/src/backend/backup/basebackup_target.c
@@ -40,7 +40,7 @@ static void *server_check_detail(char *target, char *target_detail);
 static BaseBackupTargetType builtin_backup_targets[] =
 {
 	{
-		"blackhole", reject_target_detail, blackhole_get_sink
+		"server-blackhole", reject_target_detail, blackhole_get_sink
 	},
 	{
 		"server", server_check_detail, server_get_sink
@@ -185,7 +185,7 @@ initialize_target_list(void)
 
 /*
  * Normally, a get_sink function should construct and return a new bbsink that
- * implements the backup target, but the 'blackhole' target just throws the
+ * implements the backup target, but the 'server-blackhole' target just throws the
  * data away. We could implement that by adding a bbsink that does nothing
  * but forward, but it's even cheaper to implement that by not adding a bbsink
  * at all.
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index cfcfdb8b580..1b593ea73fe 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -683,13 +683,13 @@ $node->command_ok(
 	'pg_basebackup --wal-method fetch runs');
 
 $node->command_fails_like(
-	[ @pg_basebackup_defs, '--target' => 'blackhole' ],
+	[ @pg_basebackup_defs, '--target' => 'server-blackhole' ],
 	qr/WAL cannot be streamed when a backup target is specified/,
 	'backup target requires --wal-method');
 $node->command_fails_like(
 	[
 		@pg_basebackup_defs,
-		'--target' => 'blackhole',
+		'--target' => 'server-blackhole',
 		'--wal-method' => 'stream'
 	],
 	qr/WAL cannot be streamed when a backup target is specified/,
@@ -701,7 +701,7 @@ $node->command_fails_like(
 $node->command_fails_like(
 	[
 		@pg_basebackup_defs,
-		'--target' => 'blackhole',
+		'--target' => 'server-blackhole',
 		'--wal-method' => 'none',
 		'--pgdata' => "$tempdir/blackhole"
 	],
@@ -710,7 +710,7 @@ $node->command_fails_like(
 $node->command_fails_like(
 	[
 		@pg_basebackup_defs,
-		'--target' => 'blackhole',
+		'--target' => 'server-blackhole',
 		'--wal-method' => 'none',
 		'--format' => 'tar'
 	],
@@ -719,7 +719,7 @@ $node->command_fails_like(
 $node->command_ok(
 	[
 		@pg_basebackup_defs,
-		'--target' => 'blackhole',
+		'--target' => 'server-blackhole',
 		'--wal-method' => 'none'
 	],
 	'backup target blackhole');
@@ -780,7 +780,7 @@ $node->command_fails_like(
 $node->command_fails_like(
 	[
 		@pg_basebackup_defs,
-		'--target' => 'blackhole',
+		'--target' => 'server-blackhole',
 		'--pgdata' => "$tempdir/blackhole"
 	],
 	qr/cannot specify both output directory and backup target/,
-- 
2.43.0

