Re: Postgres12 - Confusion with pg_restore

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: Laura Smith <n5d9xq3ti233xiyif2vp(at)protonmail(dot)ch>
Cc: postgre <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Postgres12 - Confusion with pg_restore
Date: 2020-06-05 18:23:39
Message-ID: 1134E38C-C188-4950-A050-E2C2D6EED7E2@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Jun 5, 2020, at 11:20, Laura Smith <n5d9xq3ti233xiyif2vp(at)protonmail(dot)ch> wrote:
> sudo -u postgres pg_restore -v -C -d foobar 4_foobar_pgdump_Fc

You need to connect to a database that already exists (such as "postgres"); it then creates the database you are restoring and switches to it. The relevant manual line is:

"When (-C / --create) 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."

--
-- Christophe Pettus
xof(at)thebuild(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laura Smith 2020-06-05 18:27:11 Re: Postgres12 - Confusion with pg_restore
Previous Message Laura Smith 2020-06-05 18:20:48 Postgres12 - Confusion with pg_restore