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 1lb2UF-0004xE-5I for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Apr 2021 14:45:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lb2UE-0007mi-3A for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Apr 2021 14:45:22 +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 1lb1U7-0004sF-PC for pgsql-bugs@lists.postgresql.org; Mon, 26 Apr 2021 13:41:12 +0000 Received: from [64.147.123.35] (helo=wforward5-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lb1U4-0000vn-Cj for pgsql-bugs@lists.postgresql.org; Mon, 26 Apr 2021 13:41:10 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.west.internal (Postfix) with ESMTP id 9CE19173A; Mon, 26 Apr 2021 09:40:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 26 Apr 2021 09:40:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=kPgcigOZDeeA1+mSg64IdbP5yIuOPgU8V5+pLgFDA Mw=; b=C3TxGzH21Cen4/Bo9u5kqattjrjSP/JFfkHnwoH/DdQrIHJhD3R5v+hTX 38W04bhRyjp88ftNlSo7f7i+h5qjPMonhVxx8J6RXOiaFaxGlhtN90+CmxS1rBgc HDQO75oi/pyrrhq95RFdVS38oZTUca8KKFFzh9tX9EM9H61VtqGPhywxbbGlI/hc nfVFEGepX2Jsg/y+9ghFvEHUni3TQeLH08/S29K+vFeJ2ig1z4MSpT1O7FT7TjK/ vttghzhltM3719vK61ufA/h0uYZN+7UQlC/5YrCnevC0HW0io32jAzXLyA+Bu01p hchBnYUTe569Fygp5abSd9W91Mjxg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddukedgieelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefheenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvg hrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhepfeethedvkefgfeegkedv hfeujeffueevfeethedvfffhueejhffgueeuhffgkeeknecuffhomhgrihhnpehpohhsth hgrhgvshhqlhdrohhrghenucfkphepledurddugedrvddvgedruddvtdenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvg hnthhrrghuthesvghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Received: from laptop206oxuk.local (p5b0ee078.dip0.t-ipconnect.de [91.14.224.120]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 26 Apr 2021 09:40:54 -0400 (EDT) Subject: Re: pg_restore - generated column - not populating To: Tom Lane , Santosh Udupi Cc: Adrian Klaver , pgsql-bugs@lists.postgresql.org References: <9881df8c-f88e-977e-f222-adb04ba1ec80@aklaver.com> <89a62c70-4386-a3ef-f2ea-5e0f448cef11@aklaver.com> <0275a27c-2447-f8e5-489b-d7e419997299@aklaver.com> <3874667.1614101644@sss.pgh.pa.us> <3877970.1614105611@sss.pgh.pa.us> <4007188.1614128586@sss.pgh.pa.us> From: Peter Eisentraut Message-ID: Date: Mon, 26 Apr 2021 15:40:53 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <4007188.1614128586@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 64.147.123.35 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 24.02.21 02:03, Tom Lane wrote: > [ redirecting to pgsql-bugs ] > > Santosh Udupi writes: >> Here is my table structure. > > Indeed, this looks pretty busted, both in v13 and HEAD. It seems that > pg_dump is not coping well with GENERATED columns attached to a > partition parent table. I made the attached script with a bit of > sample data, loaded it into an empty database, and dumped it. > The dump is evidently assuming that ALTER TABLE ATTACH PARTITION > is going to cause the generated-ness of the columns to propagate > to the children, but it doesn't. There also seems to be considerable > confusion about which columns of the child tables should be included > in the dumped data. > > I suspect this example is revealing bugs in both the backend > (ATTACH PARTITION ought to take care of this, no?) and pg_dump > (the backend can't be blamed for pg_dump's choices of columns > to dump). Peter? The backend side of this would be fixed by the proposed (it's the same code for ALTER TABLE ... INHERIT and ATTACH PARTITION). The pg_dump side can apparently be fixed by adding diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..c210883ca3 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -585,7 +585,7 @@ flagInhAttrs(DumpOptions *dopt, TableInfo *tblinfo, int numTables) } /* Remove generation expression from child */ - if (foundGenerated && !dopt->binary_upgrade) + if (foundGenerated && !dopt->binary_upgrade && !tbinfo->ispartition) tbinfo->attrdefs[j] = NULL; } } Looks like this was accidentally broken by the last minor release's fixes in this area.