Re: Postgres12 - Confusion with pg_restore - Mailing list pgsql-general

From Tom Lane
Subject Re: Postgres12 - Confusion with pg_restore
Date
Msg-id 1511852.1591382126@sss.pgh.pa.us
Whole thread Raw
In response to Re: Postgres12 - Confusion with pg_restore  (Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>)
Responses Re: Postgres12 - Confusion with pg_restore  (Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>)
List pgsql-general
Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch> writes:
> But doesn't the second half of my original post demonstrate that I tried that very thing  ?  I did try creating the
databasefirst, but pg_restore just complained even more ? 

There are two ways you can do this:

1. Create the new database by hand (with CREATE DATABASE) and tell
pg_restore to restore into it.  In this case you *don't* say -C
to pg_restore, and your -d switch points at the DB to restore into.

2. Have pg_restore issue CREATE DATABASE.  In this case you *do* use
the -C switch, and your -d switch has to point at some pre-existing
database that pg_restore can connect to for long enough to issue the
CREATE DATABASE.

You can't mix-and-match these approaches.

            regards, tom lane



pgsql-general by date:

Previous
From: Laura Smith
Date:
Subject: Re: Postgres12 - Confusion with pg_restore
Next
From: Paul van der Linden
Date:
Subject: Re: Possible improvement