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 1pUB1G-0002YC-0S for pgsql-general@arkaria.postgresql.org; Mon, 20 Feb 2023 18:36:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pUB1E-0002cN-Rh for pgsql-general@arkaria.postgresql.org; Mon, 20 Feb 2023 18:36:08 +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 1pUB1E-0002bM-H0 for pgsql-general@lists.postgresql.org; Mon, 20 Feb 2023 18:36:08 +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 1pUB14-0000L8-Og for pgsql-general@lists.postgresql.org; Mon, 20 Feb 2023 18:36:06 +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 31KIZvkw3630677; Mon, 20 Feb 2023 13:35:57 -0500 From: Tom Lane To: pf@pfortin.com cc: pgsql-general@lists.postgresql.org Subject: Re: pg_dump'ed file contains "DROP DATABASE" In-reply-to: <20230220132705.3a81a48f.pfortin@pfortin.com> References: <20230220132705.3a81a48f.pfortin@pfortin.com> Comments: In-reply-to pf@pfortin.com message dated "Mon, 20 Feb 2023 13:27:05 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3630675.1676918157.1@sss.pgh.pa.us> Date: Mon, 20 Feb 2023 13:35:57 -0500 Message-ID: <3630676.1676918157@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk pf@pfortin.com writes: > The other day, I restored his first file with: > pg_restore --host "localhost" --port "5432" --username "postgres" > --no-password --dbname "myname" --create --clean --verbose "dumpfile" > Was my 134 table[1] myname DB saved because it was open? Yup. > If the dump file > contains the above statements, how can I be absolutely certain I won't > lose the DB? Reading the manual is advisable. --create --clean specifies exactly that the target database is to be dropped and recreated. regards, tom lane