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 1v6iPN-008aWT-WF for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Oct 2025 04:37:42 +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 1v6iPL-00FqXJ-69 for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Oct 2025 04:37:40 +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 1v6iPK-00FqX3-HB for pgsql-hackers@lists.postgresql.org; Thu, 09 Oct 2025 04:37:39 +0000 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1v6iPI-000mzB-1u for pgsql-hackers@postgresql.org; Thu, 09 Oct 2025 04:37:38 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 6ACFC1D00125; Thu, 9 Oct 2025 00:37:36 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Thu, 09 Oct 2025 00:37:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1759984656; x=1760071056; bh=0lVg75tVWe 73XfExcgwEig7mKb57k27gpzTPuP5DJQg=; b=SFBe8WQaLtLZiVUlTYNUm1E2aa jqoFIRpVyHAQUuTf6r/dQJzKPza0gj9zqWAdhSrWPv66ilIirihMu+rFtjKoSfrr CAcAmdBqgUGfIb4kQcVffy0yR/0LedevhPcqnjwBvIMLsBLAuEf2MN5xEzA2jAh5 xIQTL8a+coNWHRDQEfFTiL4YxzJhsK1V4E6TxA6oK3Uo76/0jQWKR70uUKfmiFNb 2Wobd3iBYQlCEyDMAdUEzjB3EnMGoCZwb9O9ERKZtkzA7P9eJ+x+XRLHz7twAgVG qNoVIa3esR875OcVyGrFhp2BRCGMU4Y366KF5z6F200dov1j0kvUOBh357lQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1759984656; x=1760071056; bh=0lVg75tVWe73XfExcgwEig7mKb57k27gpzT PuP5DJQg=; b=MxeWA2Hc30E1qjZPAyNAhK5PKf+fXT053atWcSW5uQ5mvztOf3B Vb6Eo+fdy882tT86eyGQvPu0zK8DvBPYZezIVgMXDRw5whMEB7gtSEc1wjay6MpY 6yc8P4OVGylzmkgYyU7hAST6NXLBRLPIx82/W/eIsCGtf9hnptgleLV7/Cpw6SGB 3EfPX50o8hSZkmNCXAu2cBnVtbJjZjjyc9O0lnJ/HCddqSSJjP8fxAZN310xCiG7 ey0O+a4nqWiDEPNlRqYMmbIFIiSfm+rtwjrgxzc7sywTp3PJAtOMPzaTEciHPk/e lWbVvxyfmFvLrJsRCJgI1awwtmDHUpy9aew== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddutdehvdegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepkhhurh houggrrdhhrgihrghtohesfhhujhhithhsuhdrtghomhdprhgtphhtthhopehsmhhithhh phgsvddvhedtsehgmhgrihhlrdgtohhmpdhrtghpthhtohepihifrghtrgdrrgihrgesfh hujhhithhsuhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehpohhs thhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 9 Oct 2025 00:37:33 -0400 (EDT) Date: Thu, 9 Oct 2025 13:37:16 +0900 From: Michael Paquier To: "Hayato Kuroda (Fujitsu)" Cc: 'Peter Smith' , "Aya Iwata (Fujitsu)" , pgsql-hackers Subject: Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="w6TqxXLXMwrsGCUT" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --w6TqxXLXMwrsGCUT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Oct 09, 2025 at 04:00:24AM +0000, Hayato Kuroda (Fujitsu) wrote: > Based on that, I imagined that we could launch a bgworker and create > another database by using template. Or is it already handled? Oh, I was not following you here. Yes, we should have something with a bgworker connected to a source and make sure that it disconnects when create a new database with this source as template. However, could there be more to consider here? Contrary to DROP DATABASE, where we require the drop to be done by the owner of the database (or a superuser), CREATE DATABASE has less requirements: it is fine for a role to create a database if they have the CREATEDB rights. If we allow bgworkers to be cancelled when the database they are connected to is used as a source, that may be disruptive, so we had better document precisely the behavior of the flag and what users should expect from it when set. We are already killing autovacuum workers when they are connected to a database used as a source anyway (since 4abd7b49f1e9 from 2008), so I am worrying for nothing and it is actually better to apply the same rule across the board. Let's just document very clearly how the bgworker will react when the cancel flag is set in all these cases. -- Michael --w6TqxXLXMwrsGCUT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmjnO/wACgkQnvQgOdby QH1D9w//eDjM0pVk8q6IAVL3C8UePr3e/LI1NA35QH2mQnnrJ6pbLmMiLjb5WY9K 1emT0BDPIVXsUrDsz3zDudIa0PZhUj8/NdrHqFqOU1TkFl09dy3DSX2QfIOUBtaD +FmfkaYuUNUXKmnyEkHseZCL+06SwIXAqc4eLHrF+jvrNeHI3L5KTSy1hyNCYrdM Hrzs72X6Mj7mmdclYl0SakUJze4YyO4LoCYtLYBwAuniZUQaDfItRhGzPOcIUhDG HUX7IQuicSi3V5jwmrGDAFj/tZGUuhVTRyrCOv69S2CU/6zl5t/8so9Af8co47ih Zt0LmAtE+9KsIk+etLuFMMY/5TIHhIE97LlZGuyR37AIOjXG4+1yo3H79B635xOd sQxn53VMzoJ2sF1mTy33OpiXqygP/KleSGtDuqLnEemalc3q/HACJxBy5pLt0w3U 5psR8AnIl4tpLxocQDEYEKB+8OXYXvwRwwXjaS2qWjIKTogD21cBAQukm2RMhPWu 3y7SGZZARc5HMxU2kvTidDcNitqwgtppmgJPPRpRUlUWP40IiXUrS6ZqP90pd1vu tG4xtNW3BCV87fq1on9Uew+vVVH/w3oBG0IYIYrFRyncpr3ay7XSIbN5K5MSOeeY FEs54frpOv3u4maqqP3wrMdhuJez2YGzWx5cup1noPZlhUNOam8= =IqSc -----END PGP SIGNATURE----- --w6TqxXLXMwrsGCUT--