Em qua, 13 de fev de 2019 às 19:56, Andrew Gierth
<and...@tao11.riddles.org.uk> escreveu:
> One of the remarkably common user errors with pg_restore is users
> leaving off the -d option. (We get cases of it regularly on the IRC
> channel, including one just now which prompted me to finally propose
> this)
>
I'm not sure it is a common error. If you want to restore schema
and/or data it is natural that I should specify the database name (or
at least PGDATABASE).

> I propose we add a new option: --convert-to-text or some such name, and
> then make pg_restore throw a usage error if neither -d nor the new
> option is given.
>
However, I agree that pg_restore to stdout if -d wasn't specified is
not a good default. The current behavior is the same as "-f -"
(however, pg_restore doesn't allow - meaning stdout). Isn't it the
case to error out if -d or -f wasn't specified? If we go to this road,
-f option should allow - (stdout) as parameter.

> (Yes, it will break the scripts of anyone who is currently scripting
> pg_restore to output SQL text. How many people do that?)
>
I use pg_restore to stdout a lot but I wouldn't bother to specify an
option to get it (such as pg_restore -Fc -f - /tmp/foo.dmp).


-- 
   Euler Taveira                                   Timbira -
http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

Reply via email to