From: Andres Freund <andres@anarazel.de>
To: Kouber Saparev <kouber@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@postgresql.org
Subject: Re: Is it safe to rename an index through pg_class update?
Date: Mon, 9 Mar 2020 11:34:40 -0700
Message-ID: <20200309183440.hptayvs3axqtfc27@alap3.anarazel.de> (raw)
In-Reply-To: <CAN4RuQsnrYKWGQyxTsc2YB+88wBhGugMeX3nQgtVH5_hx6LmBg@mail.gmail.com>
References: <CAN4RuQtkwaP90yUvpP8=nJGoYTk_ni50=8e=jHvwHyetz3=MJA@mail.gmail.com>
<21995.1582818756@sss.pgh.pa.us>
<20200306173805.4yznqcchzojzk7dl@alap3.anarazel.de>
<CAN4RuQsnrYKWGQyxTsc2YB+88wBhGugMeX3nQgtVH5_hx6LmBg@mail.gmail.com>
Hi,
On 2020-03-09 17:47:23 +0200, Kouber Saparev wrote:
> На пт, 6.03.2020 г. в 21:00 Andres Freund <andres@anarazel.de> написа:
> > On 2020-02-27 10:52:36 -0500, Tom Lane wrote:
> > > 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.
> >
> > It likely could cause some problems if somebody concurrently executed
> > DDL affecting the same table. At least some "concurrently updated"
> > errors, and perhaps some worse ones. I'd at least add an explicit LOCK
> > TABLE on the underlying table that prevents concurrent catalog
> > modifications.
> >
>
> I am trying to escape the Access Exclusive lock over the table indeed,
> otherwise I would use the ALTER statement instead anyway, which makes a
> lock implicitly. Thanks for the responses.
You'd not have to take an ACCESS EXCLUSIVE. A lower level would
suffice, e.g. SHARE UPDATE EXCLUSIVE, which still allows data changes.
> There is nobody else doing DDLs except me - Mr. DBA, so I guess I am
> safe on this side. ;)
If autovacuum triggered a vacuum/analyze it'd would e.g. also try to
update pg_class.
Greetings,
Andres Freund
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: andres@anarazel.de, kouber@gmail.com, tgl@sss.pgh.pa.us
Subject: Re: Is it safe to rename an index through pg_class update?
In-Reply-To: <20200309183440.hptayvs3axqtfc27@alap3.anarazel.de>
References: <CAN4RuQtkwaP90yUvpP8=nJGoYTk_ni50=8e=jHvwHyetz3=MJA@mail.gmail.com> <21995.1582818756@sss.pgh.pa.us> <20200306173805.4yznqcchzojzk7dl@alap3.anarazel.de> <CAN4RuQsnrYKWGQyxTsc2YB+88wBhGugMeX3nQgtVH5_hx6LmBg@mail.gmail.com> <20200309183440.hptayvs3axqtfc27@alap3.anarazel.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox