Re: proposal: pg_restore --convert-to-text

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Alvaro Herrera" <alvherre(at)2ndquadrant(dot)com>
Cc: "José Arthur Benetasso Villanova" <jose(dot)arthur(at)gmail(dot)com>,"Imai, Yoshikazu" <imai(dot)yoshikazu(at)jp(dot)fujitsu(dot)com>,"Euler Taveira" <euler(at)timbira(dot)com(dot)br>,"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>,"Andreas Karlsson" <andreas(at)proxel(dot)se>,"Andrew Gierth" <andrew(at)tao11(dot)riddles(dot)org(dot)uk>,"pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: pg_restore --convert-to-text
Date: 2019-07-03 16:43:46
Message-ID: 3f8705d4-9a4f-47ea-8271-1865f04cf5d3@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera wrote:

> So you suggest that it should be
>
> pg_restore: error: one of -d/--dbname, -f/--file and -l/--list must be
> specified
> ?

I'd suggest this minimal fix :

(int argc, char **argv)
/* Complain if neither -f nor -d was specified (except if dumping
TOC) */
if (!opts->dbname && !opts->filename && !opts->tocSummary)
{
- pg_log_error("one of -d/--dbname and -f/--file must be
specified");
+ pg_log_error("-d/--dbname or -f/--file or -l/--list must be
specified");
+ fprintf(stderr, _("Try \"%s --help\" for more
information.\n"),
+ progname);
exit_nicely(1);
}

> So you suggest that it should be
> pg_restore [connection-option...] { -d | -f | -l } [option...] [filename]
> ?

Looking at the other commands, it doesn't seem that we use this form for
any of those that require at least one argument, for instance:

===
$ ./pg_basebackup
pg_basebackup: error: no target directory specified
Try "pg_basebackup --help" for more information.

$ ./pg_basebackup --help
pg_basebackup takes a base backup of a running PostgreSQL server.

Usage:
pg_basebackup [OPTION]...

$ ./pg_checksums
pg_checksums: error: no data directory specified
Try "pg_checksums --help" for more information.

$ ./pg_checksums --help
pg_checksums enables, disables, or verifies data checksums in a PostgreSQL
database cluster.

Usage:
pg_checksums [OPTION]... [DATADIR]

$ ./pg_rewind
pg_rewind: error: no source specified (--source-pgdata or --source-server)
Try "pg_rewind --help" for more information.

$ ./pg_rewind --help
pg_rewind resynchronizes a PostgreSQL cluster with another copy of the
cluster.

Usage:
pg_rewind [OPTION]...
===

"pg_restore [OPTION]... [FILE]" appears to be consistent with those, even
with the new condition that no option is an error, so it's probably okay.

> Output target options:
> -l, --list print summarized TOC of the archive
> -d, --dbname=NAME connect to database name
> -f, --file=FILENAME output file name (- for stdout)

That makes sense. I would put this section first, before
"General options".

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jesper Pedersen 2019-07-03 17:31:21 Re: Index Skip Scan
Previous Message Binguo Bao 2019-07-03 16:06:13 Re: Optimize partial TOAST decompression