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 1pe3Qb-0005Og-4O for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Mar 2023 00:31:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pe3QZ-00026K-W4 for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Mar 2023 00:31:07 +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 1pe3QZ-00026B-Md for pgsql-hackers@lists.postgresql.org; Mon, 20 Mar 2023 00:31:07 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pe3QV-0003BB-1I for pgsql-hackers@postgresql.org; Mon, 20 Mar 2023 00:31:06 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EF1E75C0054; Sun, 19 Mar 2023 20:31:01 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 19 Mar 2023 20:31:01 -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=fm2; t=1679272261; x=1679358661; bh=ku 1kvbhAubr/36pN/AMB15XAUUi5WYhWLdmgbOvzYX0=; b=gii8nMQ9UllrTgB8lu lzFVxW54bOpAq5af8QyF4y/oFW9iGHRxn8Xr76EIaRhrVPvdNs7aSzY7izz6BJsC Fcu+eXEx+izuuMed1e3xv/BcdSF7cfpS84bMARSmIBs/JoqhmgozDH0GPjLEPBl3 qZ7hXAfEmjk9VnidcAnf6wETHsw8eSQnM26uZni1LqHbSzE4D3cqhF/n8X66qeLN 94ILBtFzBNOwuc3K3DgFVHHJru3UIcL21KMGrmwYELlven/Dd3ChDIZiw6/+VVJV ec/ydN0s7fkP8aftk/V9V/5eu0iVIQabJQ+XYfzTuH4kKqmqWxjba/UQuAjsF++l 2zhA== 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=fm2; t=1679272261; x=1679358661; bh=ku1kvbhAubr/3 6pN/AMB15XAUUi5WYhWLdmgbOvzYX0=; b=XlUP37iUgvFRA/xQUdS6ogm3N8Y+D rthjN3W/SciX7n318nWIe0CSmnxkRco4UyDNRFrNa75Oo+VvhgPfOxSqqCstu3qo gw0rEPiEhAilwDUajtMutQDPV82o9hXnWnXwdPdCxqj+OKf2XC7bSGPiwAarFlnw U8rZh6eTNGgQby7bix13oeP1gnVJj0AL+sZg1pgTlwnaOL2m3I8BWF/MBqvmd7Zn ZrB1/tMQMRrBtgmEya5VyNwv7zWQvkrnYrOaGa5spUgwZUCUV3A6A0PnXYbzD6hN JCjXDPrV4MkxzuvgVoktOgTMdwmQwkLI9YuDHqmY09C8+RJ3+v6U6gWyQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdefjedgvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 19 Mar 2023 20:30:55 -0400 (EDT) Date: Mon, 20 Mar 2023 09:30:50 +0900 From: Michael Paquier To: Soumyadeep Chakraborty Cc: Zhihong Yu , Justin Pryzby , pgsql-hackers , Ashwin Agrawal , vanjared@vmware.com Subject: Re: ALTER TABLE SET ACCESS METHOD on partitioned tables Message-ID: References: <20220518231414.GN19626@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="2ykndK8jgER2NvFn" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --2ykndK8jgER2NvFn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Jun 09, 2022 at 11:21:58AM -0700, Soumyadeep Chakraborty wrote: > Thanks. Fixed and rebased. I think that I am OK with the concept of this patch to use a partitioned table's relam as a reference when creating a partition rather than relying on the default GUC, in a way similar to tablespaces. One worry I see is that forcing a recursion on the leaves on ALTER TABLE could silently break partitions where multiple table AMs are used across separate partitions if ALTER TABLE SET ACCESS METHOD is used on one of the parents, though it seems like this is not something I would much worry about as now the command is an error. A second worry is that we would just break existing creation flows that rely on the GUC defining the default AM. This is worth a close lookup at pg_dump to make sure that we do things correctly with this patch in place.. Did you check dump and restore flows with partition trees and --no-table-access-method? Perhaps there should be some regression tests with partitioned tables? + /* + * For partitioned tables, when no access method is specified, we + * default to the parent table's AM. + */ + Assert(list_length(inheritOids) == 1); + /* XXX: should implement get_rel_relam? */ + relid = linitial_oid(inheritOids); + tup = SearchSysCache1(RELOID, ObjectIdGetDatum(relid)); + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for relation %u", relid); Having a wrapper for that could be useful, yes. We don't have any code paths that would directly need that now, from what I can see, though. This patch gives one reason to have one. -- Michael --2ykndK8jgER2NvFn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmQXqToACgkQnvQgOdby QH2HPxAAi+Q5NA4fw9Rchiyk9DzF+hhdFnDzyHvheiAxAatvNTjVSPwz5jTqdoKm YRHQ/DTPiCHoy8Ac9Ar8XkOY6EJLa1ba9f4PFieggoNl2icHH3tm4eQdTtbZ4dG1 ELy1nGNK0aLB3dYeV0DPZW1iLrWiz1j3aM2utAibZq32ARrO+uZaIuU/csUeDzNN VCXnoncefbQ+718DEWVMUydvD+OzK8+ihjKLgA/PlcvkRB+DNFQy6tBAdleIvApA r19wCC7fbw+Em3pbOYc4Qby3T8p4KVx+kv/BeC4JtGM2u6zptLyhYD4Aj6ATV6R1 Un2x/um7Y6KnchZs/7WGSxjI2kUSLirsbhoZSFvulb2Tj9JuLa0DOk6fcsz5Xl+4 Gsdv8iVRxz4l5/gaY+8UQX28toHm1BypfqfwiTetCa4JrsuI+9ydI5g/UN/L+6xl CoA1TW//5brRihHGJzV2wbwAZl8p74daATWxpZjfN7YHb/fZmlFEtofQMtmsR59m yP7M7tkoteR+hiEUqdDQm85uee4tBT4mnED+Z0cCKYuWgoDzgWqG/uO79/Bm+Vdj TZc2Vkki5qkbz/htzEdocxsCXsSjVp0e0UoRdr/uAUP2hl3hbKLD1zhPdK5FBk9c lZxs5Kfq8A5jBFjNFtdyARcVli5HWWbjaZm7PnZWNLz74O+3uGw= =+bfY -----END PGP SIGNATURE----- --2ykndK8jgER2NvFn--