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 1rwb9W-002rDD-KA for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Apr 2024 05:14: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 1rwb9V-000ya3-8x for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Apr 2024 05:14:41 +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 1rwb9U-000yZv-Vf for pgsql-hackers@lists.postgresql.org; Tue, 16 Apr 2024 05:14:40 +0000 Received: from wfhigh6-smtp.messagingengine.com ([64.147.123.157]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rwb9S-003543-DX for pgsql-hackers@postgresql.org; Tue, 16 Apr 2024 05:14:39 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.west.internal (Postfix) with ESMTP id 80BD6180012E; Tue, 16 Apr 2024 01:14:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 16 Apr 2024 01:14:37 -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=1713244476; x=1713330876; bh=t2hQzbOvw+ K2OEgQtODXsJDP5PxGiFXbmtA+tuMoHgw=; b=MhA7b5DXg/lQgMX+1sSGIgfIt9 HHGgnY/5EC2cyjVmKBzYLW5dZ3BQ8/AXEJIhQhqQVPjrlm8++LKCSHJXAb1nOzLE nZNhccSq2okFa6iV9zvNEUm2V4UYHeGc3XYN92JBKvPIj5iUfChuRQH+6imy5jKv UkTPOjtwG2ZyfDiBJc4TP8Fu2ZE1GtJ2204vHwi1WdeVOyLWN7BaWMA/20UMKkRh /GujJ1ILrM1azisEM69kICcpuEH3por64BfOybl0e2In57n51Q3CME7r1pvUXkrP KRZNeLbB4JbhvMvuYNo3cAGfOlbDQOR32qty0dWiom7nLb/XXLFs+rJGrrfQ== 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-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1713244476; x=1713330876; bh=t2hQzbOvw+K2OEgQtODXsJDP5PxG iFXbmtA+tuMoHgw=; b=oqXUn7aZlD4xdUw6szwbxvUkwpdEi7LzY+mIR358MIXs 3jk6gavh1Tfs5b/5lZyH+7jt3/lQJy5iuvu+0326XMQWSHhQBZlmhD8+lX/CN9UY 3cz026ImIkr8NXxV/IgVTKKgiCu3zOmQQFOF0JWFUJo1e+sMpDX53Wri81EHFCrF e32Fg8AiLNMVjgMQRgcQIcyKFFrgwJiVeZDUvrMEH5Dw4b/vOZqusWclAymR9ktT z8dHCUiQrd/M+10vnQiG6Hbu2xQD9S/XHQ2y2ePuC8Qp8x/HgnnEqVkiR/g2XFsu E4D+rHsGkppzBKXaBkr7GY9NQLkzo/CNumsYE02WBQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudejfedgleegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 16 Apr 2024 01:14:32 -0400 (EDT) Date: Tue, 16 Apr 2024 14:14:21 +0900 From: Michael Paquier To: Tom Lane Cc: Justin Pryzby , Alexander Lakhin , Alvaro Herrera , Peter Eisentraut , 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: <202403281558.xk5pgf7ur3dq@alvherre.pgsql> <1464385.1712034366@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hD3ZOqMUo7BoyBD2" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --hD3ZOqMUo7BoyBD2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 15, 2024 at 10:46:00AM +0900, Michael Paquier wrote: > There is no need for a catalog here to trigger the failure, and it > would have happened as long as a foreign table is used. The problem > introduced in 374c7a229042 fixed by e2395cdbe83a comes from a thinko > on my side, my apologies for that and the delay in replying. Thanks > for the extra fix done in 13b3b62746ec, Alvaro. While doing more tests with this feature, among other things, I've spotted an incorrect behavior with dump/restore with the handling of the GUC default_table_access_method when it comes to partitions. Imagine the following in database "a": CREATE TABLE parent_tab (id int) PARTITION BY RANGE (id); CREATE TABLE parent_tab_2 (id int) PARTITION BY RANGE (id) USING heap; CREATE TABLE parent_tab_3 (id int) PARTITION BY RANGE (id); This leads to the following in pg_class: =3D# SELECT relname, relam FROM pg_class WHERE oid > 16000; relname | relam=20 --------------+------- parent_tab | 0 parent_tab_2 | 2 parent_tab_3 | 0 (3 rows) Now, let's do the following: $ createdb b $ pg_dump | psql b $ psql b =3D# SELECT relname, relam FROM pg_class WHERE oid > 16000; relname | relam=20 --------------+------- parent_tab | 0 parent_tab_2 | 0 parent_tab_3 | 0 (3 rows) And parent_tab_2 would now rely on the default GUC when creating new partitions rather than enforce heap. It seems to me that we are going to extend the GUC default_table_access_method with a "default" mode to be able to force relam to 0 and make a difference with the non-0 case, in the same way as ALTER TABLE SET ACCESS METHOD DEFAULT. The thing is that, like tablespaces, we have to rely on a GUC and not a USING clause to be able to handle --no-table-access-method. An interesting point comes to what we should do for default_table_access_method set to "default" when dealing with something else than a partitioned table, where an error may be adapted. Still, I'm wondering if there are more flavors I lack imagination for. This requires more careful design work. Perhaps somebody has a good idea? -- Michael --hD3ZOqMUo7BoyBD2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmYeCS0ACgkQnvQgOdby QH1sJg/+NRZ9lkM8HWafXiDuOw3a7hS/vCTUIacJAHiMMOIkaaaIKf2lqiA58flq 2Dv+D6krd30Emw9xurfEgxoTTqTEbHDpVtgL5LDqfVq+VgkZCNH23VfM8wuuqMUD QqTc8ulFbcO3rTFqU2TPX054q2nPNb9Xl+VCaHBMMg/tY4dHtHsIR3gvBj29fJo3 63P98kPxMX2c1Wa3G3YAjQ12GlFAJAecFd0Q6g94Av2x3rb718nh78aH77V0Zb/u OCU2hKOw4y2YHizmGHmO+DClCq3YA9/62lpLTU2EF9AcAv2HRdYFfiVmxT3AXjK1 Pc29cL0hRshY6zREh3G8n8Zy3Tg2iyNVQyik4cOE6ITCTXLVCNasLjCVEUTf+ivz Vc2eF/gDhFSgtVak2FMjhUOiQ4/ZI2+U6WDesXgFcCPUfL407HDEHeJhti3hLcff XxLYjnDN+ZW0HEcUhAojJ9oXpzIxCtZegmJzoEOUYeQ+9ArRSUcg9mBT2ITcRZIM O68VX9Uh56fqACzPXXRUtg/OW3GoYQExQXFO2tzQN25VOhce183nbNT11gv/Kio2 wxLshO2V0R05MyC81QY81TCI7ONvGi/O9I+hJy0HpwSPMbGvg7pDNAzc12nZyhGs mP/Zp81dk/ni1FO+lw4dBvjdPGyDqFxBelCha+/mLcfsGKKGyA8= =kqdk -----END PGP SIGNATURE----- --hD3ZOqMUo7BoyBD2--