pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>
Cc: Christophe Pettus <xof@thebuild.com>
Cc: postgre <pgsql-general@lists.postgresql.org>
Subject: Re: Postgres12 - Confusion with pg_restore
Date: Fri, 05 Jun 2020 14:35:26 -0400
Message-ID: <1511852.1591382126@sss.pgh.pa.us> (raw)
In-Reply-To: <hFqAaHJzjLuVOICQpkqZg85tNRMME-i2UsGK-5SVst7NNstNPco9oRFhxztD2xnc8M0AVWh111b4F0P5zDgzazENq-L5Br_LSJkM7Uc2lCQ=@protonmail.ch>
References: <swGhpjlYbJk4-gy0O7mkmfijTCHp8W3-2aXmb5xCXnMXBfwUzCT87YCWcmkCPfYNvyLqHoV8sMsd6wBePEZShGBSBDQ6XITJlNrpdns3IAM=@protonmail.ch>
	<1134E38C-C188-4950-A050-E2C2D6EED7E2@thebuild.com>
	<hFqAaHJzjLuVOICQpkqZg85tNRMME-i2UsGK-5SVst7NNstNPco9oRFhxztD2xnc8M0AVWh111b4F0P5zDgzazENq-L5Br_LSJkM7Uc2lCQ=@protonmail.ch>

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 database first, 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





view thread (5+ messages)  latest in thread

Message-ID: <1511852.1591382126@sss.pgh.pa.us>
Permalink:  ../1511852.1591382126@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1511852.1591382126@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, n5d9xq3ti233xiyif2vp@protonmail.ch, xof@thebuild.com
  Subject: Re: Postgres12 - Confusion with pg_restore
  In-Reply-To: <1511852.1591382126@sss.pgh.pa.us>
  References: <swGhpjlYbJk4-gy0O7mkmfijTCHp8W3-2aXmb5xCXnMXBfwUzCT87YCWcmkCPfYNvyLqHoV8sMsd6wBePEZShGBSBDQ6XITJlNrpdns3IAM=@protonmail.ch> <1134E38C-C188-4950-A050-E2C2D6EED7E2@thebuild.com> <hFqAaHJzjLuVOICQpkqZg85tNRMME-i2UsGK-5SVst7NNstNPco9oRFhxztD2xnc8M0AVWh111b4F0P5zDgzazENq-L5Br_LSJkM7Uc2lCQ=@protonmail.ch> <1511852.1591382126@sss.pgh.pa.us>

* 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