Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhHBl-0007SJ-4X for pgsql-general@arkaria.postgresql.org; Fri, 05 Jun 2020 18:35:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jhHBj-0007Lb-NZ for pgsql-general@arkaria.postgresql.org; Fri, 05 Jun 2020 18:35:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhHBj-0007LU-FV for pgsql-general@lists.postgresql.org; Fri, 05 Jun 2020 18:35:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhHBf-00072u-OX for pgsql-general@lists.postgresql.org; Fri, 05 Jun 2020 18:35:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 055IZQiU1511853; Fri, 5 Jun 2020 14:35:26 -0400 From: Tom Lane To: Laura Smith cc: Christophe Pettus , postgre Subject: Re: Postgres12 - Confusion with pg_restore In-reply-to: References: <1134E38C-C188-4950-A050-E2C2D6EED7E2@thebuild.com> Comments: In-reply-to Laura Smith message dated "Fri, 05 Jun 2020 18:27:11 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1511851.1591382126.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 05 Jun 2020 14:35:26 -0400 Message-ID: <1511852.1591382126@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Laura Smith 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