Re: pg_restore --clean --create reference documentation incongruity

From: "Hunley, Douglas" <douglas(dot)hunley(at)openscg(dot)com>
To: Matteo Fabbri <ma(dot)fabbri(at)teamsystem(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>, Matteo Fabbri <matteo(dot)fabbri(at)eutelia(dot)com>
Subject: Re: pg_restore --clean --create reference documentation incongruity
Date: 2016-10-13 14:23:19
Message-ID: CAAD=pwHaNOWUiyJBK9Fcez-O1rz4P=+sR-nQ3bxO761gHevYVg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Fri, Oct 7, 2016 at 5:32 AM, Matteo Fabbri <ma(dot)fabbri(at)teamsystem(dot)com>
wrote:

> I expected the specified db (-d TEST1) was dropped and created, not the
> TEST2 db.
>
> In essence it seems that the –d parameter is ignored and TEST1 db remains
> untouched.
>
> What is the correct behavior? Is a pg_restore error? Is a reference
> documentation error? Or simply I have not interpreted correctly it?
>

You're misunderstanding the documentation slightly. The '-d' parameter is
what database to connect to. The '-c' and '-C' parameters define how
pg_restore handles the database(s) defined inside the dump.

Think of it this way, if you have a completely new empty PostgreSQL
install, and you have a dump of 'testdb' you want to restore, you can't use
'-d testdb' because you can't connect to a db that doesn't exist yet.

--
{
"name" : "douglas j hunley",
"email" : "douglas(dot)hunley(at)openscg(dot)com <doug(dot)hunley(at)gmail(dot)com>",
"title" : "database engineer",
"phone" : "+1 732 339 3419 x163"
}

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Hunley, Douglas 2016-10-13 14:30:08 Re: PostgresSQL 9.5 and systemd autorestart but without replication.
Previous Message Rob Emery 2016-10-13 11:51:16 Distribution shipped vs Postgres Repository