public inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
missing documentation detail?
3+ messages / 3 participants
[nested] [flat]

* missing documentation detail?
@ 2025-12-17 00:45 PG Doc comments form <noreply@postgresql.org>
  2025-12-17 13:20 ` Re: missing documentation detail? David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Doc comments form @ 2025-12-17 00:45 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: camac2025@yahoo.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/18/app-pgverifybackup.html
Description:

I was disappointed not to find the return code information on the
pg_verifybackup pages - I am using the utility in a script and it seems I
cannot distinguish between an invalid or 'bad' backup and a failed run (due
to e.g. bad path, missing manifest file) - it *seems* that either will
simply return as 1 but I am not certain. I would like to differentiate
between these states.


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: missing documentation detail?
  2025-12-17 00:45 missing documentation detail? PG Doc comments form <noreply@postgresql.org>
@ 2025-12-17 13:20 ` David G. Johnston <david.g.johnston@gmail.com>
  2025-12-17 14:06   ` Re: missing documentation detail? Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 3+ messages in thread

From: David G. Johnston @ 2025-12-17 13:20 UTC (permalink / raw)
  To: camac2025@yahoo.com <camac2025@yahoo.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

On Tuesday, December 16, 2025, PG Doc comments form <noreply@postgresql.org>
wrote:

> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/18/app-pgverifybackup.html
> Description:
>
> I was disappointed not to find the return code information on the
> pg_verifybackup pages - I am using the utility in a script and it seems I
> cannot distinguish between an invalid or 'bad' backup and a failed run (due
> to e.g. bad path, missing manifest file) - it *seems* that either will
> simply return as 1 but I am not certain. I would like to differentiate
> between these states.
>

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).

David J.


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: missing documentation detail?
  2025-12-17 00:45 missing documentation detail? PG Doc comments form <noreply@postgresql.org>
  2025-12-17 13:20 ` Re: missing documentation detail? David G. Johnston <david.g.johnston@gmail.com>
@ 2025-12-17 14:06   ` Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 0 replies; 3+ messages in thread

From: Daniel Gustafsson @ 2025-12-17 14:06 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: camac2025@yahoo.com <camac2025@yahoo.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

> 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);
 }
 
 /*


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2025-12-17 14:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-12-17 00:45 missing documentation detail? PG Doc comments form <noreply@postgresql.org>
2025-12-17 13:20 ` David G. Johnston <david.g.johnston@gmail.com>
2025-12-17 14:06   ` Daniel Gustafsson <daniel@yesql.se>

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