pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_restore dumps all data to the terminal
4+ messages / 2 participants
[nested] [flat]

* pg_restore dumps all data to the terminal
@ 2018-04-27 02:56  Ron <ronljohnsonjr@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Ron @ 2018-04-27 02:56 UTC (permalink / raw)
  To: pgsql-admin

Hi,

v9.6.8, restoring from 8.4.17

This command dumps not just the schema to the terminal (technically, 
nohup.out) but the actual data.  How do I stop that?  There's no --quiet, 
and that's not what I want anyway...

pg_restore -cC --if-exists -e -Fd -j4 ${SOURCE}/${DB}

"pg_dump --verbose"lists each object as it is backed up, and that's what I 
was expecting pg_restore to do.

Thanks

-- 
Angular momentum makes the world go 'round.

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

* Re: pg_restore dumps all data to the terminal
@ 2018-04-27 03:15  David G. Johnston <david.g.johnston@gmail.com>
  parent: Ron <ronljohnsonjr@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: David G. Johnston @ 2018-04-27 03:15 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-admin

On Thursday, April 26, 2018, Ron <ronljohnsonjr@gmail.com> wrote:

> Hi,
>
> v9.6.8, restoring from 8.4.17
>
> This command dumps not just the schema to the terminal (technically,
> nohup.out) but the actual data.  How do I stop that?  There's no --quiet,
> and that's not what I want anyway...
>
> pg_restore -cC --if-exists -e -Fd -j4 ${SOURCE}/${DB}
>
>
"pg_restore can operate in two modes. If a database name is specified,
pg_restore connects to that database and restores archive contents directly
into the database. Otherwise, a script containing the SQL commands
necessary to rebuild the database is created and written to a file or
standard output."

You haven't specified a database so you get the second mode.

David J.

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

* Re: pg_restore dumps all data to the terminal
@ 2018-04-27 03:31  Ron <ronljohnsonjr@gmail.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Ron @ 2018-04-27 03:31 UTC (permalink / raw)
  To: pgsql-admin



On 04/26/2018 10:15 PM, David G. Johnston wrote:
> On Thursday, April 26, 2018, Ron <ronljohnsonjr@gmail.com 
> <mailto:ronljohnsonjr@gmail.com>> wrote:
>
>     Hi,
>
>     v9.6.8, restoring from 8.4.17
>
>     This command dumps not just the schema to the terminal (technically,
>     nohup.out) but the actual data.  How do I stop that?  There's no
>     --quiet, and that's not what I want anyway...
>
>     pg_restore -cC --if-exists -e -Fd -j4 ${SOURCE}/${DB}
>
>
> "pg_restore can operate in two modes. If a database name is specified, 
> pg_restore connects to that database and restores archive contents 
> directly into the database. Otherwise, a script containing the SQL 
> commands necessary to rebuild the database is created and written to a 
> file or standard output."
>
> You haven't specified a database so you get the second mode.

But the database doesn't exist.  If I have to explicitly create the DB 
beforehand, what's the purpose of the "--create" option?

But... looking more carefully at the examples, I see that one must attach to 
the postgres db when you want pg_restore to create the database.  (That 
should be made clear in the --create section of the manual.)

Thanks

-- 
Angular momentum makes the world go 'round.

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

* Re: pg_restore dumps all data to the terminal
@ 2018-04-27 03:50  David G. Johnston <david.g.johnston@gmail.com>
  parent: Ron <ronljohnsonjr@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: David G. Johnston @ 2018-04-27 03:50 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-admin

On Thursday, April 26, 2018, Ron <ronljohnsonjr@gmail.com> wrote:
>
>
> But... looking more carefully at the examples, I see that one must attach
> to the postgres db when you want pg_restore to create the database.  (That
> should be made clear in the --create section of the manual.)
>
> " --create
 When this option is used, the database named with -d is used only to issue
the initial DROP DATABASE and CREATE DATABASE commands. All data is
restored into the database name that appears in the archive. "

You have to connect to a database in order to perform work in the cluster
as a whole - which includes creating new databases.  The postgres database,
being created by default, usually suffices but isn't mandatory.

For me the manual is clear but you can propose wording or even submit a
patch if you feel it can be improved.

David J.

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


end of thread, other threads:[~2018-04-27 03:50 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-04-27 02:56 pg_restore dumps all data to the terminal Ron <ronljohnsonjr@gmail.com>
2018-04-27 03:15 ` David G. Johnston <david.g.johnston@gmail.com>
2018-04-27 03:31   ` Ron <ronljohnsonjr@gmail.com>
2018-04-27 03:50     ` David G. Johnston <david.g.johnston@gmail.com>

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