Is it safe to rename an index through pg_class update? - Mailing list pgsql-general

From Kouber Saparev
Subject Is it safe to rename an index through pg_class update?
Date
Msg-id CAN4RuQtkwaP90yUvpP8=nJGoYTk_ni50=8e=jHvwHyetz3=MJA@mail.gmail.com
Whole thread Raw
Responses Re: Is it safe to rename an index through pg_class update?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hello everybody,

Renaming an index the classical way through "ALTER INDEX xxx RENAME TO yyy" needs an AccessExclusiveLock over the table holding the index (at least on 9.3 it does). Instead, couldn't I simply:

UPDATE pg_class SET relname = 'yyy' WHERE oid = 'xxx'::regclass;

Are there any risks to corrupt the database or to lose concurrent transactions? I tried to make some tests with parallel queries and locks over the table, but I did not discover anything special.

--
Kouber Saparev

pgsql-general by date:

Previous
From: "sivapostgres@yahoo.com"
Date:
Subject: Re: Need to find the no. of connections for a database
Next
From: Iban Rodriguez
Date:
Subject: Re: unexpected behavior with pglogical -- bug?