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 1qLbkG-000FRg-CA for pgsql-bugs@arkaria.postgresql.org; Tue, 18 Jul 2023 03:51:28 +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 1qLbkE-003Bwp-Ec for pgsql-bugs@arkaria.postgresql.org; Tue, 18 Jul 2023 03:51:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qLbkE-003BuY-5g for pgsql-bugs@lists.postgresql.org; Tue, 18 Jul 2023 03:51:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qLbk7-0003Ia-6E for pgsql-bugs@lists.postgresql.org; Tue, 18 Jul 2023 03:51:24 +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 36I3pGVV4134282; Mon, 17 Jul 2023 23:51:17 -0400 From: Tom Lane To: vignesh C cc: Joan , pgsql-bugs@lists.postgresql.org Subject: Re: pg_dump needs an option to add the force flag to the drop database In-reply-to: References: Comments: In-reply-to vignesh C message dated "Tue, 18 Jul 2023 09:10:45 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4134280.1689652276.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 17 Jul 2023 23:51:16 -0400 Message-ID: <4134281.1689652276@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk vignesh C writes: > On Mon, 17 Jul 2023 at 14:18, Joan wrote: >> Having an option to add the FORCE option to either the generated dump b= y pg_dump, or in the pg_restore would be very useful when restoring the da= tabases so it would avoid having to do scripting. > It would be better to raise this enhancement request in -hackers, as > it can be discussed there and taken forward accordingly from there. Yeah, this is not a bug. I'm not sure that it's a sane feature request either. pg_dump scripts are not designed to deal with concurrent modifications to the target database during restore, and I doubt that we want to invest effort in making them proof against such situations. Even if you only consider read-only concurrent accesses, what client is going to be pleased with seeing a half-restored database? So I don't quite follow what is the use-case for doing DROP DATABASE FORCE here. Realistically you need a stronger defense against concurrent users than that would offer. regards, tom lane