Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hpg3s-0001ep-5t for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Jul 2019 21:41:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hpg3q-0004El-2c for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Jul 2019 21:41:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hpg3p-0004Do-RJ for pgsql-bugs@lists.postgresql.org; Mon, 22 Jul 2019 21:41:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hpg3n-0004Wo-HK for pgsql-bugs@lists.postgresql.org; Mon, 22 Jul 2019 21:41:33 +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 x6MLfQoQ020402; Mon, 22 Jul 2019 17:41:26 -0400 From: Tom Lane To: Michael Paquier cc: Manuel Rigger , PostgreSQL mailing lists Subject: Re: REINDEX CONCURRENTLY causes ALTER TABLE to fail In-reply-to: <20190718042543.GE1416@paquier.xyz> References: <20190718030232.GD1416@paquier.xyz> <20190718042543.GE1416@paquier.xyz> Comments: In-reply-to Michael Paquier message dated "Thu, 18 Jul 2019 13:25:43 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20400.1563831686.1@sss.pgh.pa.us> Date: Mon, 22 Jul 2019 17:41:26 -0400 Message-ID: <20401.1563831686@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > I have done some work on that, and for now I am finishing with the > attached. This takes the approach of updating BuildIndexInfo() so as > the optimizations for the planner are not done. This seems like a really bad idea. As you have it, whether the relcache contains optimized or unoptimized expressions will be basically chance, depending on which sort of call happened first after the last cache flush. That will break things, because for most use-cases it's *not* optional to apply eval_const_expressions. Even without that, changing the APIs of the functions you've touched here seems pretty invasive. I think the correct fix is to nuke the code in REINDEX CONCURRENTLY that thinks it should use any of this infrastructure to fetch the existing index properties, and just have it read the catalog directly instead. regards, tom lane