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.92) (envelope-from ) id 1j7PXv-0002tV-Cd for pgsql-general@arkaria.postgresql.org; Thu, 27 Feb 2020 20:14:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j7PXu-00070O-2F for pgsql-general@arkaria.postgresql.org; Thu, 27 Feb 2020 20:14:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j7PXt-00070H-Le for pgsql-general@lists.postgresql.org; Thu, 27 Feb 2020 20:14:09 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j7PXr-0004ab-E1 for pgsql-general@postgresql.org; Thu, 27 Feb 2020 20:14:08 +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 01RKE5qI013302; Thu, 27 Feb 2020 15:14:05 -0500 From: Tom Lane To: Kouber Saparev cc: pgsql-general@postgresql.org Subject: Re: Is it safe to rename an index through pg_class update? In-reply-to: References: <21995.1582818756@sss.pgh.pa.us> Comments: In-reply-to Kouber Saparev message dated "Thu, 27 Feb 2020 18:08:17 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <13300.1582834445.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 27 Feb 2020 15:14:05 -0500 Message-ID: <13301.1582834445@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Kouber Saparev writes: > =D0=9D=D0=B0 =D1=87=D1=82, 27.02.2020 =D0=B3. =D0=B2 17:52 Tom Lane =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0: >> FWIW, I can't immediately think of a reason this would cause a problem, >> at least not on 9.4 and up which use MVCC catalog scans. If you're >> really still on 9.3 then it's notably more risky. In any case, I've >> not had any caffeine yet today, so this doesn't count for much. > Ah, 9.3 is not using MVCC for system catalogs?... Ouch. Then most probab= ly > it is really not a good idea. That said, I am not modifying table names, > only index names... and I guess the internals, the planner etc. are not > working with names, but with oids instead? The issue is whether a SnapshotNow scan would find any row at all. If it reaches the new row version before that's committed good, and the old one after that's committed dead, you'll get some weird "cache lookup failed" or similar failure --- just transiently, but nonetheless a failure. Pre-9.4 versions were dependent on proper locking to avoid that issue, and what you propose would bypass that. regards, tom lane