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 1eoHag-0000ag-2v for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Feb 2018 23:44:54 +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 1eoHad-0006ZB-Sd for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Feb 2018 23:44:51 +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 1eoHad-0006Z1-Jj for pgsql-bugs@lists.postgresql.org; Tue, 20 Feb 2018 23:44:51 +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 1eoHaa-0001xE-Ud for pgsql-bugs@postgresql.org; Tue, 20 Feb 2018 23:44:50 +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 w1KNil9P032727; Tue, 20 Feb 2018 18:44:47 -0500 From: Tom Lane To: Claudio Freire cc: pgsql-bugs@postgresql.org Subject: Re: pg_upgrade and materialized views In-reply-to: References: <23575.1519162064@sss.pgh.pa.us> <24838.1519163208@sss.pgh.pa.us> Comments: In-reply-to Claudio Freire message dated "Tue, 20 Feb 2018 20:09:08 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32725.1519170287.1@sss.pgh.pa.us> Date: Tue, 20 Feb 2018 18:44:47 -0500 Message-ID: <32726.1519170287@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Claudio Freire writes: >> Well, the attached script reproduces the issue. One thing this doesn't prove by itself is whether the use of REFRESH MATERIALIZED VIEW CONCURRENTLY has any effect on the situation. I poked at that a bit and noted that REFRESH MATERIALIZED VIEW CONCURRENTLY doesn't seem to change the matview's relfrozenxid at all, while a plain REFRESH advances the matview's relfrozenxid to (more or less) the current xid counter. That probably isn't a bug, but maybe there's a missed optimization opportunity there. At any rate, the matview's relfrozenxid isn't going backwards, so my original fear seems unfounded. 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. regards, tom lane