Re: Is it safe to rename an index through pg_class update?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Is it safe to rename an index through pg_class update?
Дата
Msg-id 21995.1582818756@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Is it safe to rename an index through pg_class update?  (Kouber Saparev <kouber@gmail.com>)
Ответы Re: Is it safe to rename an index through pg_class update?  (Kouber Saparev <kouber@gmail.com>)
Re: Is it safe to rename an index through pg_class update?  (Andres Freund <andres@anarazel.de>)
Список pgsql-general
Kouber Saparev <kouber@gmail.com> writes:
> 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;

There's a lot of stuff like that that you can probably get away with...
but I'm not sure it's prudent to try it on valuable production data.
If it breaks your database nobody is going to have any sympathy for you.

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.

            regards, tom lane



В списке pgsql-general по дате отправления:

Предыдущее
От: Iban Rodriguez
Дата:
Сообщение: Re: unexpected behavior with pglogical -- bug?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Error “cache lookup failed for function”