Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eoICb-0003Kr-Tn for pgsql-bugs@arkaria.postgresql.org; Wed, 21 Feb 2018 00:24:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoICa-00044x-SL for pgsql-bugs@arkaria.postgresql.org; Wed, 21 Feb 2018 00:24:04 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eoICa-00044o-Ja for pgsql-bugs@lists.postgresql.org; Wed, 21 Feb 2018 00:24:04 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eoICX-0002m6-C7 for pgsql-bugs@lists.postgresql.org; Wed, 21 Feb 2018 00:24:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w1L0Nv3K002778; Tue, 20 Feb 2018 19:23:57 -0500 From: Tom Lane To: Andres Freund cc: pgsql-bugs@lists.postgresql.org, Claudio Freire Subject: Re: pg_upgrade and materialized views In-reply-to: <1AA7ED45-0DE1-481E-B174-602121425F53@anarazel.de> References: <23575.1519162064@sss.pgh.pa.us> <24838.1519163208@sss.pgh.pa.us> <32726.1519170287@sss.pgh.pa.us> <1AA7ED45-0DE1-481E-B174-602121425F53@anarazel.de> Comments: In-reply-to Andres Freund message dated "Tue, 20 Feb 2018 16:06:25 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2776.1519172637.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 20 Feb 2018 19:23:57 -0500 Message-ID: <2777.1519172637@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On February 20, 2018 3:44:47 PM PST, Tom Lane wrote: >> Anyway, I'm thinking the core of the problem here is that we've got >> multiple places that know which relkinds are physically transferred >> during a pg_upgrade, and they don't all know the same thing. We >> need to centralize that knowledge somehow, or we're going to be >> singing this same tune again in the future. Not quite sure where >> to put it though. pg_dump and pg_upgrade both need to know that, >> but the backend doesn't, so I don't quite want to add it in >> pg_class.h where the core list of relkinds is. > Why do we need any relkind checks here at all? Shouldn't we just transpo= rt all xid horizons that are set before into the new cluster without filte= ring? The ones on relations without storage are meaningless, and I'm not sure it's a good idea to set them nonzero if they're zero initially. In any case, pg_upgrade *has to* be selective about which files it tries to physically transfer --- even skipping nonexistent files wouldn't be good enough, since it should not transfer sequence files. Also, you were right to complain before that some of the issue here is considering "must hack dropped columns" to be identical to "must hack relfrozenxid". It's not clear that that's true, eg I think the answer is different for RELKIND_PARTITIONED_TABLE. regards, tom lane