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 1pgwxt-0006sz-C9 for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Mar 2023 00:13:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pgwxr-0006zP-6z for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Mar 2023 00:13:27 +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 1pgwxp-0006zG-GP for pgsql-hackers@lists.postgresql.org; Tue, 28 Mar 2023 00:13:26 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pgwxm-0003qC-G3 for pgsql-hackers@postgresql.org; Tue, 28 Mar 2023 00:13:24 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 3E4165C01C0; Mon, 27 Mar 2023 20:13:20 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 27 Mar 2023 20:13:20 -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=1679962400; x=1680048800; bh=vB 6ytBvbioXzKSrBL8pSh7YjY7KUMADJc4Tpb3PvfMA=; b=kxG3nRW3eXpKOXuTTf H76OH/TizOB+SRPTFkuGt7wFitzA1msDUIzYiR5uK7/sO4HDfZ7G8gDDl5VxVLRR 18uo6Rfs+kUQ6qOas9QGWB+UgxPvelHZCLsR8j0CmarPAOYrJFsrLkltan7EWy34 P1oaqXU+Q3M9w7CDFE28shrBN4CD6XJhEm4I6pWszACOqD5cqId/9XaCGID8OZjc CMh0miwe0CBaG1fjag4F7gS3l5tyctOhnYIsum/G2hr1vtAZ+B6s3SvFuwiHPfI8 HJM+gj39lXrfkJZhAOuYOMsTQTpPmwkFo8zKQijEKaOxILLA3pmRAGUHcNTe5z01 G80g== 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=1679962400; x=1680048800; bh=vB6ytBvbioXzK SrBL8pSh7YjY7KUMADJc4Tpb3PvfMA=; b=uf3Y+sAvUF3X9Jyh1GECeduEQGTDJ qH+r7vCjP089/dACEhaEu3IJS84dXFLfeXcQi5GyQNJ+K45jar/8vQs7NR86Qb9f 8jPj8M+Je/KrXLS9AeteGNxwiTbkmz6VcFcCQmym1Dlxb9+y17ijUJ6vaGjbjEiI aRmZTY8f8Hc0iuFocxSaURAKpZ+eu/qzceZM65R1TxrV1SPkh/BtPQLjRxbch4LQ 09zFRl2k0XoTUcet9D+74yHwDJeVsvXkfpJHNP8zMXQf3+srHt4O3LA7D6E3MvQL jweCId4kS41SMGInmAyEo9EA3l8oy7wRwPaf3t+T+R50AiFEIYjxpkhBQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdehfedgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 27 Mar 2023 20:13:16 -0400 (EDT) Date: Tue, 28 Mar 2023 09:13:10 +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="gtBRNuwwskge2Ikj" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --gtBRNuwwskge2Ikj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Mar 20, 2023 at 09:30:50AM +0900, Michael Paquier wrote: > 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? I was looking at the patch, and as I suspected the dumps generated are forgetting to apply the AM to the partitioned tables. For example, assuming that the default AM is heap, the patch creates child_0_10 with heap2 as AM, which is what we want: CREATE ACCESS METHOD heap2 TYPE TABLE HANDLER heap_tableam_handler; CREATE TABLE parent_tab (id int) PARTITION BY RANGE (id) USING heap2; CREATE TABLE child_0_10 PARTITION OF parent_tab FOR VALUES FROM (0) TO (10); However a dump produces that (content cut except for its most relevant parts): CREATE ACCESS METHOD heap2 TYPE TABLE HANDLER heap_tableam_handler; SET default_tablespace = ''; CREATE TABLE public.parent_tab ( id integer ) PARTITION BY RANGE (id); SET default_table_access_method = heap2; CREATE TABLE public.child_0_10 ( id integer ); This would restore the previous contents incorrectly, where parent_tab would use heap and child_0_10 would use heap2, causing any partitions created after the restore to use silently heap. This is going to require a logic similar to tablespaces, where generate SET commands on default_table_access_method so as --no-table-access-method in pg_dump and pg_restore are able to work correctly. Having tests to cover all that is a must-have. -- Michael --gtBRNuwwskge2Ikj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmQiMRYACgkQnvQgOdby QH0Bow/+MtPaRInMi10mEa8AU4h0cljuvpQmBeSxP+0eIpnxqElOMEH9WD7eYOkn TOR7Jnt4ZGZN1NTCREENhHjgK3qNb1FgU/B9KqFBupK10ElWSn8fH9efDddIdgR7 hhWAl6VrgG7WL3fCYKZolQt84bmjhKswPVbKGlo10d1yo5PlObVf6kVxEW60Dk3d +yl+yCkbF/S+3ONkdRRwMlLYIsHroQ0diu9PBvL2VgJNRiLB8kCXtyKMYM8S3jMx lw51MnvaGTtJHWUOK/KdKwr807S4dd0B7bK1qWPOzwygakOEUJSyUbrbuttMG3M4 zqPUOH44x5UwmbIHZUUJ5o+TkjtdL1z1z11b01gI2GFCtKjOO+RZEWhbecRr7Pco 70pOC6P3Ir21fXILKlwG9uS+e7Uuff6Nd/5NLAXmimKxaLaVIs0nRZ09EPzMgjFA lWyPPvYn21V7AQiqkMCh/P8xEeeNWnHt35qzXuZxGXL5NA9yS9MruemnzIEjBDRy 3L3GDJMX/IEagtKGqZTWe735hBO3CLU1XySEZ6OUigMNdsSn3vb/ZM/oeN6Sz9yl 9sosUjnfR8bHreTQ7688f8fCAnyruR1Wx2E1KUNx8TEKq0GQYEkT0AIyfGPstamG vY89fauQ2Rd5MDoNG/K4bq5KSWG3/DE2mx+9rTWJphHbDpNZWf4= =AxXW -----END PGP SIGNATURE----- --gtBRNuwwskge2Ikj--