Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tMBJE-002Rya-1b for pgsql-general@arkaria.postgresql.org; Fri, 13 Dec 2024 19:26:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tMBJB-00BLDg-5N for pgsql-general@arkaria.postgresql.org; Fri, 13 Dec 2024 19:26:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tMBJA-00BLDV-Qr for pgsql-general@lists.postgresql.org; Fri, 13 Dec 2024 19:26:42 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tMBJ8-002h4b-QU for pgsql-general@postgresql.org; Fri, 13 Dec 2024 19:26:41 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 9E0B02A43D0 for ; Fri, 13 Dec 2024 11:26:37 -0800 (PST) Date: Fri, 13 Dec 2024 11:26:37 -0800 (PST) From: Rich Shepard To: pgsql-general@postgresql.org Subject: Re: Restoring database from backup In-Reply-To: Message-ID: References: <3745bd88-413f-4fa5-90a1-d374852d10a9@aklaver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 13 Dec 2024, Adrian Klaver wrote: > Alright, from here: > > https://www.postgresql.org/docs/current/app-pgdump.html > > "-c > --clean > > Output commands to DROP all the dumped database objects prior to > outputting the commands for creating them. This option is useful when the > restore is to overwrite an existing database. If any of the objects do not > exist in the destination database, ignorable error messages will be reported > during restore, unless --if-exists is also specified. > > This option is ignored when emitting an archive (non-text) output file. > For the archive formats, you can specify the option when you call pg_restore. > " > > This means when you run the script with: > > psql -d bustrac -f bustrac-2024-12-12.sql > > it will clean out the current corrupted objects and replace them with those > in the backup file. Adrian, That's what I thought since I wrote the script based on reading pgdump a long time ago. Thanks for confirming! I'll fix my carelessness now. Carpe weekend, Rich