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 1q4hlY-0008EU-Nv for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Jun 2023 12:50:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q4hlX-00085z-MJ for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Jun 2023 12:50:55 +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 1q4hlX-00085p-Cq for pgsql-hackers@lists.postgresql.org; Thu, 01 Jun 2023 12:50:55 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q4hlU-0034k1-Vw for pgsql-hackers@postgresql.org; Thu, 01 Jun 2023 12:50:54 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 737C85C0174; Thu, 1 Jun 2023 08:50:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 01 Jun 2023 08:50:52 -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:sender :subject:subject:to:to; s=fm1; t=1685623852; x=1685710252; bh=1y fJ3Lb6CEHwe3TnWzW+/GYBMR/gxMkol+uABlZfXkg=; b=FhjNEWf+jWH/o1mtEg 8CKCIMFEIPOIkTIHxxV6VPfdgC/F2GxRjFgBr03C1HgR+0G0IjkjnGgyDzpnMgr/ M37mjfR4Sr7+juz0IeU+PERYxIumKDSzIehs8U5vTyaZDlZyFEjfwzv2tuXuvIzO SVfMDOBLiabZzmGgu5D1svk+LGsieLIm/9zoPDIGm0cbHsoQ+oGXcCHtfS6OmCOc qZINHO6HE8WmX6vcvV/batChPRNbhURP8yiI/xmld9Ft7VyLWLgD/GPRnMEZsBP4 p4BEp1NKdmLxH/BjSPFBfQG5mzyIq/w/FNAG2YqVybci0T2twGZUFJm/LxGPzdLQ nIZg== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1685623852; x=1685710252; bh=1yfJ3Lb6CEHwe 3TnWzW+/GYBMR/gxMkol+uABlZfXkg=; b=SWSX0WwUXkuxvCL55yzXecunT9vGO FbHxw8FbAREzbvKx5JJzdiXDtdpBmCmU8Ve0dH1elG0bvGz3g3swkp946z9cTIh/ 0+FOpiLtwQOy6/DkgfMsrjoQ2fztBUHfT61hXAiJdp6Gxta2mx/rd80+QLv6RCXj nZbRdtlM/QNIJQmdl8D9012fKhRrq/w75FKHw7g07iPTMwd2CFWvEePpub7X0Ghq 5IcuvIB8AGf14ntmxjXWufxUNYsFunLbVw988GAP8DKmahG8sdfJzOWBHK5z4zKF 3fbzFBErqhp72gbJRe57oiT4vDUeCe23Tzb+EzfJtRbZaAOicHLon49OQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeluddgheejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Jun 2023 08:50:51 -0400 (EDT) Date: Thu, 1 Jun 2023 08:50:50 -0400 From: Michael Paquier To: Justin Pryzby Cc: Soumyadeep Chakraborty , Zhihong Yu , pgsql-hackers@postgresql.org, Ashwin Agrawal , vanjared@vmware.com Subject: Re: ALTER TABLE SET ACCESS METHOD on partitioned tables Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bATVUVE2LrQvzLLv" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --bATVUVE2LrQvzLLv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, May 31, 2023 at 06:35:34PM -0500, Justin Pryzby wrote: > What do you think the comment ought to say ? It already says: > > src/backend/catalog/heap.c- * Make a dependency link to force the relation to be deleted if its > src/backend/catalog/heap.c- * access method is. This is the third location where we rely on the fact that RELKIND_HAS_TABLE_AM() does not include RELKIND_PARTITIONED_TABLE, so it seems worth documenting what we are relying on as a comment? Say: * Make a dependency link to force the relation to be deleted if its * access method is. * * No need to add an explicit dependency for the toast table, as the * main table depends on it. Partitioned tables have a table access * method defined, and RELKIND_HAS_TABLE_AM ignores them. >> Speaking of which, ATExecSetAccessMethodNoStorage() does a catalog >> update even if ALTER TABLE is defined to use the same table AM as what >> is currently set. There is no need to update the relation's pg_class >> entry in this case. Be careful that InvokeObjectPostAlterHook() still >> needs to be checked in this case. Perhaps some tests should be added >> in test_oat_hooks.sql? It would be tempted to add a new SQL file for >> that. > > Are you suggesting to put this in a conditional: if oldrelam!=newAccessMethod ? Yes, that's what I would add with a few lines close to the beginning of ATExecSetTableSpaceNoStorage() to save from catalog updates if these are not needed. -- Michael --bATVUVE2LrQvzLLv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmR4lCoACgkQnvQgOdby QH0D/w/+OLuOiaHH6AviDVwmb6R1iLpqDsDoN9SIdETjAlEkTLszHp4E5U3fbEHF yR00083mLU9cDitbaujpO28mnJHZXiXkoYA7G9mXKAoJJ7RiS7An7IsRtQuoD1Mn 1FUPumpPOzHAZ0EWaDo+BGslAEtBZ3OI+nCL513qzeErFTWga6W6aXvM0AMWlDMO EAkhiAJjtABISP0GG86rjomYwwUzGCGk5rhXUrHO1gROcLO6DU3tJ3kzRaLXyJJR AvSYJMl757MKXs4P5iRQihVGdKS4nT8kDfWjnaIc3qzC3YyLZ5XRdbiH6cz7TPEI vYzDkkxX+y7HIZvDcq64K3HGNJmpA5SmNTZ57ccHHi+ajuKzwq+UAQDtrpbBxcyG T0H/1t6RXTL9buAyPyfx0pv0K1qbx1j34z7y0unF54Up765mjsAgyioozzVCcdXw NQrZRr/ekAlMieJpuHxpy8M5MfM731CR3lcw6j/kX6QUe76gyZypl7PciB+YFyba FIX8UfVv07vzYW2s3oqTlDP68HR+6BkLvfWPmEGQAlU27WFMWao380VeC6TrRfxr +eyty8p2IWm2hT8sSZEACEh80+jgDabvZ3znrwrgFrS3wg54dcDij71o+WlpcPpQ ZoZZYQG9ldts2EOv7HP99PWD3u4wedy5UnaNRV6KaCISXImue6A= =snbR -----END PGP SIGNATURE----- --bATVUVE2LrQvzLLv--