pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kouber Saparev <kouber@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Is it safe to rename an index through pg_class update?
Date: Thu, 27 Feb 2020 15:14:05 -0500
Message-ID: <13301.1582834445@sss.pgh.pa.us> (raw)
In-Reply-To: <CAN4RuQvUy7LPTdLR=e4-kh6HzQmTZYQO5OZ+53ABWpijS61GeA@mail.gmail.com>
References: <CAN4RuQtkwaP90yUvpP8=nJGoYTk_ni50=8e=jHvwHyetz3=MJA@mail.gmail.com>
	<21995.1582818756@sss.pgh.pa.us>
	<CAN4RuQvUy7LPTdLR=e4-kh6HzQmTZYQO5OZ+53ABWpijS61GeA@mail.gmail.com>

Kouber Saparev <kouber@gmail.com> writes:
> На чт, 27.02.2020 г. в 17:52 Tom Lane <tgl@sss.pgh.pa.us> написа:
>> 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 probably
> 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





view thread (9+ messages)  latest in thread

Message-ID: <13301.1582834445@sss.pgh.pa.us>
Permalink:  ../13301.1582834445@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13301.1582834445@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, kouber@gmail.com
  Subject: Re: Is it safe to rename an index through pg_class update?
  In-Reply-To: <13301.1582834445@sss.pgh.pa.us>
  References: <CAN4RuQtkwaP90yUvpP8=nJGoYTk_ni50=8e=jHvwHyetz3=MJA@mail.gmail.com> <21995.1582818756@sss.pgh.pa.us> <CAN4RuQvUy7LPTdLR=e4-kh6HzQmTZYQO5OZ+53ABWpijS61GeA@mail.gmail.com> <13301.1582834445@sss.pgh.pa.us>

* 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