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

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: proposal: pg_restore --convert-to-text
Дата
Msg-id 20190612170201.GA11881@alvherre.pgsql
обсуждение исходный текст
Ответ на RE: proposal: pg_restore --convert-to-text  ("Daniel Verite" <daniel@manitou-mail.org>)
Ответы Re: proposal: pg_restore --convert-to-text  ("Daniel Verite" <daniel@manitou-mail.org>)
Список pgsql-hackers
On 2019-Jun-12, Daniel Verite wrote:

> While testing pg_restore on v12, I'm stumbling on this too.

Thanks for testing.

> pg_restore without argument fails like that:
> 
> $ pg_restore
> pg_restore: error: one of -d/--dbname and -f/--file must be specified
> 
> But that's not right since "pg_restore -l dumpfile" would work.

So you suggest that it should be 

pg_restore: error: one of -d/--dbname, -f/--file and -l/--list must be specified
?

> Also, in the doc at https://www.postgresql.org/docs/devel/app-pgrestore.html
> the synopsis is
> 
>   pg_restore [connection-option...] [option...] [filename]
> 
> so the invocation without argument seems possible while in fact
> it's not.

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

Maybe we should do that and split out the "output destination options"
from other options in the list of options, to make this clearer; see
a proposal after my sig.


> In particular saying that --file must be specified leaves me with
> no idea what file it's talking about: the dumpfile or the output file?

If you want to submit a patch (for pg13) to rename --file to
--output-file (and make --file an alias of that), you're welcome to, and
endure the resulting discussion and possible rejection.  I don't think
we're changing that at this point of pg12.

> My first inclination is to transform "pg_restore dumpfile" into
> "pg_restore -f dumpfile", which does nothing but wait
> (it waits for the dumpfile on the standard input, before
> I realize that it's not working and hit ^C. Fortunately it doesn't
> overwrite the dumpfile with an empty output).

Would you have it emit to stderr a message saying "reading standard
input" when it is?

> So the change in v12 removes the standard output as default,
> but does not remove the standard input as default.
> Isn't that weird?

I don't think they have the same surprise factor.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Usage:
   pg_restore [connection-option...] { -d | -f | -l } [option...] [filename]

General options:
  -F, --format=c|d|t       backup file format (should be automatic)
  -v, --verbose            verbose mode
  -V, --version            output version information, then exit
  -?, --help               show this help, then exit

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)

Options controlling the restore:
  -a, --data-only              restore only the data, no schema
  -c, --clean                  clean (drop) database objects before recreating
  ...



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jim Finnerty
Дата:
Сообщение: Re: Adaptive query optimization
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Race conditions with checkpointer and shutdown