pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matteo Fabbri <ma.fabbri@teamsystem.com>
To: Hunley, Douglas <douglas.hunley@openscg.com>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Cc: Matteo Fabbri <matteo.fabbri@eutelia.com>
Subject: Re: pg_restore --clean --create reference documentation incongruity
Date: Thu, 13 Oct 2016 15:18:21 +0000
Message-ID: <5AA63B0D-A163-481F-AB3A-5FAABA2BA689@teamsystem.com> (raw)
In-Reply-To: <CAAD=pwHaNOWUiyJBK9Fcez-O1rz4P=+sR-nQ3bxO761gHevYVg@mail.gmail.com>
References: <16C69B44-19B0-45E3-B537-FDF85668559F@teamsystem.com>
	<CAAD=pwHaNOWUiyJBK9Fcez-O1rz4P=+sR-nQ3bxO761gHevYVg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

Ok, -d intended as the database to connect to, makes sense.
Not the words of the documentation (-C --create): “When this option is used, the database named with
-d is used only to issue the initial DROP DATABASE and CREATE DATABASE commands.”!
Thanks for the clarification,
matt

On Fri, Oct 7, 2016 at 5:32 AM, Matteo Fabbri <ma.fabbri@teamsystem.com<mailto:ma.fabbri@teamsystem.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.hunley@openscg.com<mailto:doug.hunley@gmail.com>",
  "title" : "database engineer",
  "phone" : "+1 732 339 3419 x163"
}


view thread (3+ messages)

Message-ID: <5AA63B0D-A163-481F-AB3A-5FAABA2BA689@teamsystem.com>
Permalink:  ../5AA63B0D-A163-481F-AB3A-5FAABA2BA689@teamsystem.com/
Also on:    postgresql.org/message-id/5AA63B0D-A163-481F-AB3A-5FAABA2BA689@teamsystem.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: ma.fabbri@teamsystem.com, douglas.hunley@openscg.com, matteo.fabbri@eutelia.com
  Subject: Re: pg_restore --clean --create reference documentation incongruity
  In-Reply-To: <5AA63B0D-A163-481F-AB3A-5FAABA2BA689@teamsystem.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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