public inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
From: Daniel Gustafsson <daniel@yesql.se>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: camac2025@yahoo.com <camac2025@yahoo.com>
Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Subject: Re: missing documentation detail?
Date: Wed, 17 Dec 2025 15:06:48 +0100
Message-ID: <B0D99F8D-A23D-4499-848C-3073CF8D8875@yesql.se> (raw)
In-Reply-To: <CAKFQuwY_LkJSx8j-TzK3+kuTRDr6OH6oVim-V7e0+f7zfDLDrA@mail.gmail.com>
References: <176593231445.978860.2300752490245961611@wrigleys.postgresql.org>
	<CAKFQuwY_LkJSx8j-TzK3+kuTRDr6OH6oVim-V7e0+f7zfDLDrA@mail.gmail.com>

> On 17 Dec 2025, at 14:20, David G. Johnston <david.g.johnston@gmail.com> wrote:

> This isn’t a good place to request feature enhancements.  There isn’t an issue with the documentation - the program doesn’t provide multiple conditional exit codes.
> 
> Post a patch to -hackers or a feature request to -general (mailing list).

Absolutely right, that's the best way to propose new (or changes to) features.
The proposed change here seems pretty reasonable and might be as simple as the
(untested) attached, modeled around pg_amcheck.  I noticed that pg_amcheck
doesn't document its different return values either which seems like an
oversight.

--
Daniel Gustafsson



Attachments:

  [application/octet-stream] pg_verifybackup_exit.diff (2.2K, 3-pg_verifybackup_exit.diff)
  download | inline diff:
diff --git a/doc/src/sgml/ref/pg_amcheck.sgml b/doc/src/sgml/ref/pg_amcheck.sgml
index ef2bdfd19ae..7ad7889677e 100644
--- a/doc/src/sgml/ref/pg_amcheck.sgml
+++ b/doc/src/sgml/ref/pg_amcheck.sgml
@@ -68,6 +68,13 @@ PostgreSQL documentation
    <replaceable>dbname</replaceable> can also be a
    <link linkend="libpq-connstring">connection string</link>.
   </para>
+
+  <para>
+   If <application>pg_amcheck</application> encounters a problem, the program
+   return value will be <literal>2</literal>, if there is a problem with the
+   parameters passed to the program the return value will be
+   <literal>1</literal>.
+  </para>
  </refsect1>
 
  <refsect1>
diff --git a/doc/src/sgml/ref/pg_verifybackup.sgml b/doc/src/sgml/ref/pg_verifybackup.sgml
index 61c12975e4a..aa979e56bfb 100644
--- a/doc/src/sgml/ref/pg_verifybackup.sgml
+++ b/doc/src/sgml/ref/pg_verifybackup.sgml
@@ -120,6 +120,13 @@ PostgreSQL documentation
    In contrast, the data file integrity checks should work with any version
    of the server that generates a <literal>backup_manifest</literal> file.
   </para>
+
+  <para>
+   If <literal>pg_verifybackup</literal> encounters a problem with the backup,
+   the program return value will be <literal>2</literal>, if there is a problem
+   with the parameters passed to the program the return value will be
+   <literal>1</literal>.
+  </para>
  </refsect1>
 
  <refsect1>
diff --git a/src/bin/pg_verifybackup/pg_verifybackup.c b/src/bin/pg_verifybackup/pg_verifybackup.c
index c9b24df7c05..0bc967268cb 100644
--- a/src/bin/pg_verifybackup/pg_verifybackup.c
+++ b/src/bin/pg_verifybackup/pg_verifybackup.c
@@ -514,7 +514,7 @@ report_manifest_error(JsonManifestParseContext *context, const char *fmt,...)
 	pg_log_generic_v(PG_LOG_ERROR, PG_LOG_PRIMARY, gettext(fmt), ap);
 	va_end(ap);
 
-	exit(1);
+	exit(2);
 }
 
 /*
@@ -1238,7 +1238,7 @@ report_backup_error(verifier_context *context, const char *restrict fmt,...)
 
 	context->saw_any_error = true;
 	if (context->exit_on_error)
-		exit(1);
+		exit(2);
 }
 
 /*
@@ -1253,7 +1253,7 @@ report_fatal_error(const char *restrict fmt,...)
 	pg_log_generic_v(PG_LOG_ERROR, PG_LOG_PRIMARY, gettext(fmt), ap);
 	va_end(ap);
 
-	exit(1);
+	exit(2);
 }
 
 /*


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: daniel@yesql.se, david.g.johnston@gmail.com, camac2025@yahoo.com, pgsql-docs@lists.postgresql.org
  Subject: Re: missing documentation detail?
  In-Reply-To: <B0D99F8D-A23D-4499-848C-3073CF8D8875@yesql.se>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox