On Mon, Aug 21, 2023 at 1:09 PM Masahiro Ikeda <ikeda...@oss.nttdata.com> wrote:
(1)
Why don't you add test for the purpose? It could be overkill...
I though the following function is the best place.

Added the test.

BTW, psql --help outputs the content of PGHOST, which caused a failure in the test:

```
-h, --host=HOSTNAME      database server host or socket directory
(default: "/var/folders/m7/9snkd5b54cx_b4lxkl9ljlcc0000gn/T/LobrmSUf7t")
```

It may be overkill, added a logic for removing the content of PGHOST.


On 2023-08-23 09:45, Masahiro Ikeda wrote:
Hi,

On 2023-08-22 22:57, torikoshia wrote:
On 2023-08-21 13:08, Masahiro Ikeda wrote:
(2)

Is there any reason that only src/bin commands are targeted? I found that we also need to fix vacuumlo with the above test. I think it's better to
fix it because it's a contrib module.

$ vacuumlo --help | while IFS='' read line; do echo $((`echo $line |
wc -m` - 1)) $line; done | sort -n -r  | head -n 2
84   -n, --dry-run             don't remove large objects, just show
what would be done
74 -l, --limit=LIMIT commit after removing each LIMIT large objects

This is because I wasn't sure making all --help outputs fit into 80
columns per line is right thing to do as described below:

| If this is the way to go, I'll do same things for contrib commands.

If there are no objection, I'm going to make other commands fit within
80 columns per line including (4).

OK. Sorry, I missed the sentence above.
I'd like to hear what others comment too.

Although there are no comments, attached patch modifies vaccumlo.

(3)

Is to delete '/mnt/server' intended? I though it better to leave it as
is since archive_cleanup_command example uses the absolute path.

-                        "  pg_archivecleanup /mnt/server/archiverdir
000000010000000000000010.00000020.backup\n"));
+                        "  pg_archivecleanup archiverdir
000000010000000000000010.00000020.backup\n"));

I will confirmed that the --help text are not changed and only
the line breaks are changed.  But, currently the above change
break it.

Yes, it is intended as described in the thread.

https://www.postgresql.org/message-id/20230615.152036.1556630042388070221.horikyota.ntt%40gmail.com

| We could shorten it by removing the "/mnt/server" portion, but
I'm not sure if it's worth doing.

However, I feel it is acceptable to make an exception and exceed 80
characters for this line.

Thanks for sharing the thread. I understood.

It seems that the directory name should be consistent with the example
of archive_cleanup_command. However, it does not seem appropriate to
make archive_cleanup_command to use a relative path.

```
pg_archivecleanup --help
(snip)
e.g.
archive_cleanup_command = 'pg_archivecleanup /mnt/server/archiverdir %r'

Or for use as a standalone archive cleaner:
e.g.
  pg_archivecleanup /mnt/server/archiverdir
000000010000000000000010.00000020.backup
```

IMHO, is simply breaking the line acceptable?

Agreed.


(4)

I found that some binaries, for example ecpg, are not tested with
program_help_ok(). Is it better to add tests in the patch?

Added program_help_ok() to ecpg and pgbench.
Although pg_regress and zic are not tested using program_help_ok, but left as they are because they are not commands that users execute directly.

--
Regards,

--
Atsushi Torikoshi
NTT DATA Group Corporation
From 4728cab3e39f7994b8b6dd41787cac90b5cb64f6 Mon Sep 17 00:00:00 2001
From: Atsushi Torikoshi <torikos...@oss.nttdata.com>
Date: Thu, 31 Aug 2023 16:22:39 +0900
Subject: [PATCH v2] Make --help output fit within 80 columns per line

Outputs of --help output of some commands fit into 80 columns per line,
while others do not.
For the consistency and for 80-column terminal, this patch makes them
fit within 80 columns per line.

Also this patch adds a test which checks if --help outputs fit within
80 columns per line.

---
 contrib/vacuumlo/vacuumlo.c                   |  3 ++-
 src/bin/initdb/initdb.c                       |  6 ++++--
 src/bin/pg_amcheck/pg_amcheck.c               | 21 ++++++++++++-------
 src/bin/pg_archivecleanup/pg_archivecleanup.c |  3 ++-
 src/bin/pg_basebackup/pg_receivewal.c         | 12 +++++++----
 src/bin/pg_basebackup/pg_recvlogical.c        | 18 ++++++++++------
 src/bin/pg_checksums/pg_checksums.c           |  3 ++-
 src/bin/pg_dump/pg_dump.c                     |  3 ++-
 src/bin/pg_dump/pg_dumpall.c                  |  3 ++-
 src/bin/pg_dump/pg_restore.c                  |  6 ++++--
 src/bin/pg_upgrade/option.c                   |  9 +++++---
 src/bin/pgbench/pgbench.c                     |  6 ++++--
 src/bin/pgbench/t/002_pgbench_no_server.pl    |  1 +
 src/bin/psql/help.c                           |  9 +++++---
 src/bin/scripts/createdb.c                    |  3 ++-
 src/bin/scripts/pg_isready.c                  |  3 ++-
 src/bin/scripts/vacuumdb.c                    | 21 ++++++++++++-------
 src/interfaces/ecpg/Makefile                  |  1 +
 src/interfaces/ecpg/t/001_basic.pl            | 14 +++++++++++++
 src/test/perl/PostgreSQL/Test/Utils.pm        | 10 +++++++++
 20 files changed, 112 insertions(+), 43 deletions(-)
 create mode 100644 src/interfaces/ecpg/t/001_basic.pl

diff --git a/contrib/vacuumlo/vacuumlo.c b/contrib/vacuumlo/vacuumlo.c
index 8941262731..39c1238802 100644
--- a/contrib/vacuumlo/vacuumlo.c
+++ b/contrib/vacuumlo/vacuumlo.c
@@ -417,7 +417,8 @@ usage(const char *progname)
 	printf("Usage:\n  %s [OPTION]... DBNAME...\n\n", progname);
 	printf("Options:\n");
 	printf("  -l, --limit=LIMIT         commit after removing each LIMIT large objects\n");
-	printf("  -n, --dry-run             don't remove large objects, just show what would be done\n");
+	printf("  -n, --dry-run             don't remove large objects, just show what would be\n"
+		   "                            done\n");
 	printf("  -v, --verbose             write a lot of progress messages\n");
 	printf("  -V, --version             output version information, then exit\n");
 	printf("  -?, --help                show this help, then exit\n");
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 905b979947..42e9e19265 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -2434,8 +2434,10 @@ usage(const char *progname)
 	printf(_("  %s [OPTION]... [DATADIR]\n"), progname);
 	printf(_("\nOptions:\n"));
 	printf(_("  -A, --auth=METHOD         default authentication method for local connections\n"));
-	printf(_("      --auth-host=METHOD    default authentication method for local TCP/IP connections\n"));
-	printf(_("      --auth-local=METHOD   default authentication method for local-socket connections\n"));
+	printf(_("      --auth-host=METHOD    default authentication method for local TCP/IP\n"
+			 "                            connections\n"));
+	printf(_("      --auth-local=METHOD   default authentication method for local-socket\n"
+			 "                            connections\n"));
 	printf(_(" [-D, --pgdata=]DATADIR     location for this database cluster\n"));
 	printf(_("  -E, --encoding=ENCODING   set default encoding for new databases\n"));
 	printf(_("  -g, --allow-group-access  allow group read/execute on data directory\n"));
diff --git a/src/bin/pg_amcheck/pg_amcheck.c b/src/bin/pg_amcheck/pg_amcheck.c
index 57df14bc1e..606383ae0b 100644
--- a/src/bin/pg_amcheck/pg_amcheck.c
+++ b/src/bin/pg_amcheck/pg_amcheck.c
@@ -1150,17 +1150,23 @@ help(const char *progname)
 	printf(_("  -S, --exclude-schema=PATTERN    do NOT check matching schema(s)\n"));
 	printf(_("  -t, --table=PATTERN             check matching table(s)\n"));
 	printf(_("  -T, --exclude-table=PATTERN     do NOT check matching table(s)\n"));
-	printf(_("      --no-dependent-indexes      do NOT expand list of relations to include indexes\n"));
-	printf(_("      --no-dependent-toast        do NOT expand list of relations to include TOAST tables\n"));
+	printf(_("      --no-dependent-indexes      do NOT expand list of relations to include\n"
+			 "                                  indexes\n"));
+	printf(_("      --no-dependent-toast        do NOT expand list of relations to include\n"
+			 "                                  TOAST tables\n"));
 	printf(_("      --no-strict-names           do NOT require patterns to match objects\n"));
 	printf(_("\nTable checking options:\n"));
 	printf(_("      --exclude-toast-pointers    do NOT follow relation TOAST pointers\n"));
 	printf(_("      --on-error-stop             stop checking at end of first corrupt page\n"));
-	printf(_("      --skip=OPTION               do NOT check \"all-frozen\" or \"all-visible\" blocks\n"));
-	printf(_("      --startblock=BLOCK          begin checking table(s) at the given block number\n"));
-	printf(_("      --endblock=BLOCK            check table(s) only up to the given block number\n"));
+	printf(_("      --skip=OPTION               do NOT check \"all-frozen\" or \"all-visible\"\n"
+			 "                                  blocks\n"));
+	printf(_("      --startblock=BLOCK          begin checking table(s) at the given block\n"
+			 "                                  number\n"));
+	printf(_("      --endblock=BLOCK            check table(s) only up to the given block\n"
+			 "                                  number\n"));
 	printf(_("\nB-tree index checking options:\n"));
-	printf(_("      --heapallindexed            check that all heap tuples are found within indexes\n"));
+	printf(_("      --heapallindexed            check that all heap tuples are found within\n"
+			 "                                  indexes\n"));
 	printf(_("      --parent-check              check index parent/child relationships\n"));
 	printf(_("      --rootdescend               search from root page to refind tuples\n"));
 	printf(_("\nConnection options:\n"));
@@ -1172,7 +1178,8 @@ help(const char *progname)
 	printf(_("      --maintenance-db=DBNAME     alternate maintenance database\n"));
 	printf(_("\nOther options:\n"));
 	printf(_("  -e, --echo                      show the commands being sent to the server\n"));
-	printf(_("  -j, --jobs=NUM                  use this many concurrent connections to the server\n"));
+	printf(_("  -j, --jobs=NUM                  use this many concurrent connections to the\n"
+			 "                                  server\n"));
 	printf(_("  -P, --progress                  show progress information\n"));
 	printf(_("  -v, --verbose                   write a lot of output\n"));
 	printf(_("  -V, --version                   output version information, then exit\n"));
diff --git a/src/bin/pg_archivecleanup/pg_archivecleanup.c b/src/bin/pg_archivecleanup/pg_archivecleanup.c
index 2c3b301f3b..6f62d4661f 100644
--- a/src/bin/pg_archivecleanup/pg_archivecleanup.c
+++ b/src/bin/pg_archivecleanup/pg_archivecleanup.c
@@ -276,7 +276,8 @@ usage(void)
 	printf(_("\n"
 			 "Or for use as a standalone archive cleaner:\n"
 			 "e.g.\n"
-			 "  pg_archivecleanup /mnt/server/archiverdir 000000010000000000000010.00000020.backup\n"));
+			 "  pg_archivecleanup /mnt/server/archiverdir\n"
+			 "    000000010000000000000010.00000020.backup\n"));
 	printf(_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
 	printf(_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
 }
diff --git a/src/bin/pg_basebackup/pg_receivewal.c b/src/bin/pg_basebackup/pg_receivewal.c
index d0a4079d50..39a40d525e 100644
--- a/src/bin/pg_basebackup/pg_receivewal.c
+++ b/src/bin/pg_basebackup/pg_receivewal.c
@@ -81,11 +81,13 @@ usage(void)
 	printf(_("\nOptions:\n"));
 	printf(_("  -D, --directory=DIR    receive write-ahead log files into this directory\n"));
 	printf(_("  -E, --endpos=LSN       exit after receiving the specified LSN\n"));
-	printf(_("      --if-not-exists    do not error if slot already exists when creating a slot\n"));
+	printf(_("      --if-not-exists    do not error if slot already exists when creating a\n"
+			 "                         slot\n"));
 	printf(_("  -n, --no-loop          do not loop on connection lost\n"));
 	printf(_("      --no-sync          do not wait for changes to be written safely to disk\n"));
 	printf(_("  -s, --status-interval=SECS\n"
-			 "                         time between status packets sent to server (default: %d)\n"), (standby_message_timeout / 1000));
+			 "                         time between status packets sent to server\n"
+			 "                         (default: %d)\n"), (standby_message_timeout / 1000));
 	printf(_("  -S, --slot=SLOTNAME    replication slot to use\n"));
 	printf(_("      --synchronous      flush write-ahead log immediately after writing\n"));
 	printf(_("  -v, --verbose          output verbose messages\n"));
@@ -101,8 +103,10 @@ usage(void)
 	printf(_("  -w, --no-password      never prompt for password\n"));
 	printf(_("  -W, --password         force password prompt (should happen automatically)\n"));
 	printf(_("\nOptional actions:\n"));
-	printf(_("      --create-slot      create a new replication slot (for the slot's name see --slot)\n"));
-	printf(_("      --drop-slot        drop the replication slot (for the slot's name see --slot)\n"));
+	printf(_("      --create-slot      create a new replication slot (for the slot's name see\n"
+			 "                         --slot)\n"));
+	printf(_("      --drop-slot        drop the replication slot (for the slot's name see\n"
+			 "                         --slot)\n"));
 	printf(_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
 	printf(_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
 }
diff --git a/src/bin/pg_basebackup/pg_recvlogical.c b/src/bin/pg_basebackup/pg_recvlogical.c
index 9fe4ac8126..e2f3d19fca 100644
--- a/src/bin/pg_basebackup/pg_recvlogical.c
+++ b/src/bin/pg_basebackup/pg_recvlogical.c
@@ -86,15 +86,19 @@ usage(void)
 	printf(_("Usage:\n"));
 	printf(_("  %s [OPTION]...\n"), progname);
 	printf(_("\nAction to be performed:\n"));
-	printf(_("      --create-slot      create a new replication slot (for the slot's name see --slot)\n"));
-	printf(_("      --drop-slot        drop the replication slot (for the slot's name see --slot)\n"));
-	printf(_("      --start            start streaming in a replication slot (for the slot's name see --slot)\n"));
+	printf(_("      --create-slot      create a new replication slot (for the slot's name see\n"
+			 "                         --slot)\n"));
+	printf(_("      --drop-slot        drop the replication slot (for the slot's name see\n"
+			 "                         --slot)\n"));
+	printf(_("      --start            start streaming in a replication slot (for the slot's\n"
+			 "                         name see --slot)\n"));
 	printf(_("\nOptions:\n"));
 	printf(_("  -E, --endpos=LSN       exit after receiving the specified LSN\n"));
 	printf(_("  -f, --file=FILE        receive log into this file, - for stdout\n"));
 	printf(_("  -F  --fsync-interval=SECS\n"
 			 "                         time between fsyncs to the output file (default: %d)\n"), (fsync_interval / 1000));
-	printf(_("      --if-not-exists    do not error if slot already exists when creating a slot\n"));
+	printf(_("      --if-not-exists    do not error if slot already exists when creating a\n"
+			 "                         slot\n"));
 	printf(_("  -I, --startpos=LSN     where in an existing slot should the streaming start\n"));
 	printf(_("  -n, --no-loop          do not loop on connection lost\n"));
 	printf(_("  -o, --option=NAME[=VALUE]\n"
@@ -102,9 +106,11 @@ usage(void)
 			 "                         output plugin\n"));
 	printf(_("  -P, --plugin=PLUGIN    use output plugin PLUGIN (default: %s)\n"), plugin);
 	printf(_("  -s, --status-interval=SECS\n"
-			 "                         time between status packets sent to server (default: %d)\n"), (standby_message_timeout / 1000));
+			 "                         time between status packets sent to server\n"
+			 "                         (default: %d)\n"), (standby_message_timeout / 1000));
 	printf(_("  -S, --slot=SLOTNAME    name of the logical replication slot\n"));
-	printf(_("  -t, --two-phase        enable decoding of prepared transactions when creating a slot\n"));
+	printf(_("  -t, --two-phase        enable decoding of prepared transactions when creating\n"
+			 "                         a slot\n"));
 	printf(_("  -v, --verbose          output verbose messages\n"));
 	printf(_("  -V, --version          output version information, then exit\n"));
 	printf(_("  -?, --help             show this help, then exit\n"));
diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c
index 19eb67e485..2b42ab7e0a 100644
--- a/src/bin/pg_checksums/pg_checksums.c
+++ b/src/bin/pg_checksums/pg_checksums.c
@@ -76,7 +76,8 @@ static pg_time_t last_progress_report = 0;
 static void
 usage(void)
 {
-	printf(_("%s enables, disables, or verifies data checksums in a PostgreSQL database cluster.\n\n"), progname);
+	printf(_("%s enables, disables, or verifies data checksums in a PostgreSQL\n"
+			 "database cluster.\n\n"), progname);
 	printf(_("Usage:\n"));
 	printf(_("  %s [OPTION]... [DATADIR]\n"), progname);
 	printf(_("\nOptions:\n"));
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 65f64c282d..bf72f2c436 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -1067,7 +1067,8 @@ help(const char *progname)
 	printf(_("  -Z, --compress=METHOD[:DETAIL]\n"
 			 "                               compress as specified\n"));
 	printf(_("  --lock-wait-timeout=TIMEOUT  fail after waiting TIMEOUT for a table lock\n"));
-	printf(_("  --no-sync                    do not wait for changes to be written safely to disk\n"));
+	printf(_("  --no-sync                    do not wait for changes to be written safely to\n"
+			 "                               disk\n"));
 	printf(_("  -?, --help                   show this help, then exit\n"));
 
 	printf(_("\nOptions controlling the output content:\n"));
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index e2a9733d34..683056852c 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -661,7 +661,8 @@ help(void)
 	printf(_("  --no-role-passwords          do not dump passwords for roles\n"));
 	printf(_("  --no-security-labels         do not dump security label assignments\n"));
 	printf(_("  --no-subscriptions           do not dump subscriptions\n"));
-	printf(_("  --no-sync                    do not wait for changes to be written safely to disk\n"));
+	printf(_("  --no-sync                    do not wait for changes to be written safely to\n"
+			 "                               disk\n"));
 	printf(_("  --no-table-access-method     do not dump table access methods\n"));
 	printf(_("  --no-tablespaces             do not dump tablespace assignments\n"));
 	printf(_("  --no-toast-compression       do not dump TOAST compression methods\n"));
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index 049a100634..fbbb9f93f8 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -459,7 +459,8 @@ usage(const char *progname)
 	printf(_("  -S, --superuser=NAME         superuser user name to use for disabling triggers\n"));
 	printf(_("  -t, --table=NAME             restore named relation (table, view, etc.)\n"));
 	printf(_("  -T, --trigger=NAME           restore named trigger\n"));
-	printf(_("  -x, --no-privileges          skip restoration of access privileges (grant/revoke)\n"));
+	printf(_("  -x, --no-privileges          skip restoration of access privileges\n"
+			 "                               (grant/revoke)\n"));
 	printf(_("  -1, --single-transaction     restore as a single transaction\n"));
 	printf(_("  --disable-triggers           disable triggers during data-only restore\n"));
 	printf(_("  --enable-row-security        enable row security\n"));
@@ -472,7 +473,8 @@ usage(const char *progname)
 	printf(_("  --no-subscriptions           do not restore subscriptions\n"));
 	printf(_("  --no-table-access-method     do not restore table access methods\n"));
 	printf(_("  --no-tablespaces             do not restore tablespace assignments\n"));
-	printf(_("  --section=SECTION            restore named section (pre-data, data, or post-data)\n"));
+	printf(_("  --section=SECTION            restore named section (pre-data, data, or\n"
+			 "                               post-data)\n"));
 	printf(_("  --strict-names               require table and/or schema include patterns to\n"
 			 "                               match at least one entity each\n"));
 	printf(_("  --use-set-session-authorization\n"
diff --git a/src/bin/pg_upgrade/option.c b/src/bin/pg_upgrade/option.c
index 640361009e..58c86309a1 100644
--- a/src/bin/pg_upgrade/option.c
+++ b/src/bin/pg_upgrade/option.c
@@ -275,9 +275,11 @@ usage(void)
 	printf(_("  -c, --check                   check clusters only, don't change any data\n"));
 	printf(_("  -d, --old-datadir=DATADIR     old cluster data directory\n"));
 	printf(_("  -D, --new-datadir=DATADIR     new cluster data directory\n"));
-	printf(_("  -j, --jobs=NUM                number of simultaneous processes or threads to use\n"));
+	printf(_("  -j, --jobs=NUM                number of simultaneous processes or threads to\n"
+			 "                                use\n"));
 	printf(_("  -k, --link                    link instead of copying files to new cluster\n"));
-	printf(_("  -N, --no-sync                 do not wait for changes to be written safely to disk\n"));
+	printf(_("  -N, --no-sync                 do not wait for changes to be written safely to\n"
+			 "                                disk\n"));
 	printf(_("  -o, --old-options=OPTIONS     old cluster options to pass to the server\n"));
 	printf(_("  -O, --new-options=OPTIONS     new cluster options to pass to the server\n"));
 	printf(_("  -p, --old-port=PORT           old cluster port number (default %d)\n"), old_cluster.port);
@@ -303,7 +305,8 @@ usage(void)
 			 "  the \"bin\" directory for the new version (-B BINDIR)\n"));
 	printf(_("\n"
 			 "For example:\n"
-			 "  pg_upgrade -d oldCluster/data -D newCluster/data -b oldCluster/bin -B newCluster/bin\n"
+			 "  pg_upgrade -d oldCluster/data -D newCluster/data\n"
+			 "             -b oldCluster/bin -B newCluster/bin\n"
 			 "or\n"));
 #ifndef WIN32
 	printf(_("  $ export PGDATAOLD=oldCluster/data\n"
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 713e8a06bb..b7ef127758 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -882,8 +882,10 @@ usage(void)
 		   "  --index-tablespace=TABLESPACE\n"
 		   "                           create indexes in the specified tablespace\n"
 		   "  --partition-method=(range|hash)\n"
-		   "                           partition pgbench_accounts with this method (default: range)\n"
-		   "  --partitions=NUM         partition pgbench_accounts into NUM parts (default: 0)\n"
+		   "                           partition pgbench_accounts with this method\n"
+		   "                           (default: range)\n"
+		   "  --partitions=NUM         partition pgbench_accounts into NUM parts\n"
+		   "                           (default: 0)\n"
 		   "  --tablespace=TABLESPACE  create tables in the specified tablespace\n"
 		   "  --unlogged-tables        create tables as unlogged tables\n"
 		   "\nOptions to select what to run:\n"
diff --git a/src/bin/pgbench/t/002_pgbench_no_server.pl b/src/bin/pgbench/t/002_pgbench_no_server.pl
index ffc8c772ae..932e80e465 100644
--- a/src/bin/pgbench/t/002_pgbench_no_server.pl
+++ b/src/bin/pgbench/t/002_pgbench_no_server.pl
@@ -234,6 +234,7 @@ for my $o (@options)
 }
 
 # Help
+program_help_ok('pgbench');
 pgbench(
 	'--help', 0,
 	[
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 38c165a627..b335cea8be 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -118,19 +118,22 @@ usage(unsigned short int pager)
 	HELP0("  -H, --html               HTML table output mode\n");
 	HELP0("  -P, --pset=VAR[=ARG]     set printing option VAR to ARG (see \\pset command)\n");
 	HELP0("  -R, --record-separator=STRING\n"
-		  "                           record separator for unaligned output (default: newline)\n");
+		  "                           record separator for unaligned output\n"
+		  "                           (default: newline)\n");
 	HELP0("  -t, --tuples-only        print rows only\n");
 	HELP0("  -T, --table-attr=TEXT    set HTML table tag attributes (e.g., width, border)\n");
 	HELP0("  -x, --expanded           turn on expanded table output\n");
 	HELP0("  -z, --field-separator-zero\n"
 		  "                           set field separator for unaligned output to zero byte\n");
 	HELP0("  -0, --record-separator-zero\n"
-		  "                           set record separator for unaligned output to zero byte\n");
+		  "                           set record separator for unaligned output to zero\n"
+		  "                           byte\n");
 
 	HELP0("\nConnection options:\n");
 	/* Display default host */
 	env = getenv("PGHOST");
-	HELPN("  -h, --host=HOSTNAME      database server host or socket directory (default: \"%s\")\n",
+	HELPN("  -h, --host=HOSTNAME      database server host or socket directory\n"
+		  "                           (default: \"%s\")\n",
 		  env ? env : _("local socket"));
 	/* Display default port */
 	env = getenv("PGPORT");
diff --git a/src/bin/scripts/createdb.c b/src/bin/scripts/createdb.c
index 9ca86a3e53..fa1f6d95e5 100644
--- a/src/bin/scripts/createdb.c
+++ b/src/bin/scripts/createdb.c
@@ -297,7 +297,8 @@ help(const char *progname)
 	printf(_("      --icu-locale=LOCALE      ICU locale setting for the database\n"));
 	printf(_("      --icu-rules=RULES        ICU rules setting for the database\n"));
 	printf(_("      --locale-provider={libc|icu}\n"
-			 "                               locale provider for the database's default collation\n"));
+			 "                               locale provider for the database's default\n"
+			 "                               collation\n"));
 	printf(_("  -O, --owner=OWNER            database user to own the new database\n"));
 	printf(_("  -S, --strategy=STRATEGY      database creation strategy wal_log or file_copy\n"));
 	printf(_("  -T, --template=TEMPLATE      template database to copy\n"));
diff --git a/src/bin/scripts/pg_isready.c b/src/bin/scripts/pg_isready.c
index 64bbffb0b2..a5e617ba1b 100644
--- a/src/bin/scripts/pg_isready.c
+++ b/src/bin/scripts/pg_isready.c
@@ -235,7 +235,8 @@ help(const char *progname)
 	printf(_("\nConnection options:\n"));
 	printf(_("  -h, --host=HOSTNAME      database server host or socket directory\n"));
 	printf(_("  -p, --port=PORT          database server port\n"));
-	printf(_("  -t, --timeout=SECS       seconds to wait when attempting connection, 0 disables (default: %s)\n"), DEFAULT_CONNECT_TIMEOUT);
+	printf(_("  -t, --timeout=SECS       seconds to wait when attempting connection,\n"
+			 "                           0 disables (default: %s)\n"), DEFAULT_CONNECT_TIMEOUT);
 	printf(_("  -U, --username=USERNAME  user name to connect as\n"));
 	printf(_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
 	printf(_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c
index f03d5b1c6c..275b8ccea1 100644
--- a/src/bin/scripts/vacuumdb.c
+++ b/src/bin/scripts/vacuumdb.c
@@ -1134,19 +1134,26 @@ help(const char *progname)
 	printf(_("  -e, --echo                      show the commands being sent to the server\n"));
 	printf(_("  -f, --full                      do full vacuuming\n"));
 	printf(_("  -F, --freeze                    freeze row transaction information\n"));
-	printf(_("      --force-index-cleanup       always remove index entries that point to dead tuples\n"));
+	printf(_("      --force-index-cleanup       always remove index entries that point to dead\n"
+			 "                                  tuples\n"));
 	printf(_("  -j, --jobs=NUM                  use this many concurrent connections to vacuum\n"));
 	printf(_("      --min-mxid-age=MXID_AGE     minimum multixact ID age of tables to vacuum\n"));
 	printf(_("      --min-xid-age=XID_AGE       minimum transaction ID age of tables to vacuum\n"));
-	printf(_("      --no-index-cleanup          don't remove index entries that point to dead tuples\n"));
+	printf(_("      --no-index-cleanup          don't remove index entries that point to dead\n"
+			 "                                  tuples\n"));
 	printf(_("      --no-process-main           skip the main relation\n"));
-	printf(_("      --no-process-toast          skip the TOAST table associated with the table to vacuum\n"));
-	printf(_("      --no-truncate               don't truncate empty pages at the end of the table\n"));
+	printf(_("      --no-process-toast          skip the TOAST table associated with the table\n"
+			 "                                  to vacuum\n"));
+	printf(_("      --no-truncate               don't truncate empty pages at the end of the\n"
+			 "                                  table\n"));
 	printf(_("  -n, --schema=PATTERN            vacuum tables in the specified schema(s) only\n"));
-	printf(_("  -N, --exclude-schema=PATTERN    do not vacuum tables in the specified schema(s)\n"));
-	printf(_("  -P, --parallel=PARALLEL_WORKERS use this many background workers for vacuum, if available\n"));
+	printf(_("  -N, --exclude-schema=PATTERN    do not vacuum tables in the specified\n"
+			 "                                  schema(s)\n"));
+	printf(_("  -P, --parallel=PARALLEL_WORKERS use this many background workers for vacuum,\n"
+			 "                                  if available\n"));
 	printf(_("  -q, --quiet                     don't write any messages\n"));
-	printf(_("      --skip-locked               skip relations that cannot be immediately locked\n"));
+	printf(_("      --skip-locked               skip relations that cannot be immediately\n"
+			 "                                  locked\n"));
 	printf(_("  -t, --table='TABLE[(COLUMNS)]'  vacuum specific table(s) only\n"));
 	printf(_("  -v, --verbose                   write a lot of output\n"));
 	printf(_("  -V, --version                   output version information, then exit\n"));
diff --git a/src/interfaces/ecpg/Makefile b/src/interfaces/ecpg/Makefile
index e4bbf7b8a8..43ef654e50 100644
--- a/src/interfaces/ecpg/Makefile
+++ b/src/interfaces/ecpg/Makefile
@@ -29,3 +29,4 @@ clean distclean maintainer-clean:
 checktcp: | temp-install
 check checktcp installcheck:
 	$(MAKE) -C test $@
+	$(prove_check)
diff --git a/src/interfaces/ecpg/t/001_basic.pl b/src/interfaces/ecpg/t/001_basic.pl
new file mode 100644
index 0000000000..7d54a0da73
--- /dev/null
+++ b/src/interfaces/ecpg/t/001_basic.pl
@@ -0,0 +1,14 @@
+
+# Copyright (c) 2021-2023, PostgreSQL Global Development Group
+
+use strict;
+use warnings;
+
+use PostgreSQL::Test::Utils;
+use Test::More;
+
+program_help_ok('ecpg');
+program_version_ok('ecpg');
+program_options_handling_ok('ecpg');
+
+done_testing();
diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm
index 617caa022f..9a721e7bcd 100644
--- a/src/test/perl/PostgreSQL/Test/Utils.pm
+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
@@ -843,6 +843,16 @@ sub program_help_ok
 	ok($result, "$cmd --help exit code 0");
 	isnt($stdout, '', "$cmd --help goes to stdout");
 	is($stderr, '', "$cmd --help nothing to stderr");
+	foreach my $line (split /\n/, $stdout)
+	{
+		if (length($line) > 80)
+		{
+			# Ignore embedded PGHOST, which can be long length
+			$line =~ s/$ENV{PGHOST}//;
+		}
+		ok(length($line) <= 80,
+			 "$cmd --help outputs fit within 80 columns per line");
+	}
 	return;
 }
 
-- 
2.39.2

Reply via email to