pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: pg_restore to new database wants to wipe out the old database?
Date: Tue, 30 Oct 2018 17:25:57 -0500
Message-ID: <8271fb47-8f04-a02b-2927-e475659274dd@gmail.com> (raw)
In-Reply-To: <CAKFQuwa5u18ASfLW4dinnuaZL9aYMwbLQP1TYtAxTu0=aWzJ4w@mail.gmail.com>
References: <4a6e3243-7fcd-e7b3-4279-ce57bc5cf5ac@gmail.com>
	<CAKFQuwa5u18ASfLW4dinnuaZL9aYMwbLQP1TYtAxTu0=aWzJ4w@mail.gmail.com>

On 10/30/2018 05:16 PM, David G. Johnston wrote:
> On Tue, Oct 30, 2018 at 3:09 PM Ron <ronljohnsonjr@gmail.com 
> <mailto:ronljohnsonjr@gmail.com>> wrote:
>
>     Hi,
>
>     v9.6.9
>
>     Why is pg_restore trying to drop my production database, when I (think
>     I) am telling it to create the new database "Molson"?
>
> Straight from the pg_restore documentation:
> -C
>
> "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."

So I've got to explicitly CREATE DATABASE "Molson" and then
pg_restore -d Molson Molson

>
> Also
> " pg_restore -vcC --if-exists --jobs=8 -d postgres Molson "
>
> pg_restore [connection-option...] [option...] [filename]
>
> "Molson" is a file name; pg_restore doesn't use the file name aside from 
> finding where the data you want to restore is located.
>
> David J.
>

-- 
Angular momentum makes the world go 'round.

view thread (4+ messages)  latest in thread

Message-ID: <8271fb47-8f04-a02b-2927-e475659274dd@gmail.com>
Permalink:  ../8271fb47-8f04-a02b-2927-e475659274dd@gmail.com/
Also on:    postgresql.org/message-id/8271fb47-8f04-a02b-2927-e475659274dd@gmail.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: pg_restore to new database wants to wipe out the old database?
  In-Reply-To: <8271fb47-8f04-a02b-2927-e475659274dd@gmail.com>
  References: <4a6e3243-7fcd-e7b3-4279-ce57bc5cf5ac@gmail.com> <CAKFQuwa5u18ASfLW4dinnuaZL9aYMwbLQP1TYtAxTu0=aWzJ4w@mail.gmail.com> <8271fb47-8f04-a02b-2927-e475659274dd@gmail.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