From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Disallow CREATE INDEX if table is already in use in current sess
Date: Sun, 04 Jun 2017 16:02:52 +0000
Message-ID: <E1dHXzQ-0007a9-KG@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Disallow CREATE INDEX if table is already in use in current session.
If we allow this, whatever outer command has the table open will not know
about the new index and may fail to update it as needed, as shown in a
report from Laurenz Albe. We already had such a prohibition in place for
ALTER TABLE, but the CREATE INDEX syntax missed the check.
Fixing it requires an API change for DefineIndex(), which conceivably
would break third-party extensions if we were to back-patch it. Given
how long this problem has existed without being noticed, fixing it in
the back branches doesn't seem worth that risk.
Discussion: https://postgr.es/m/A737B7A37273E048B164557ADEF4A58B53A4DC9A@ntex2010i.host.magwien.gv.at
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/0d1885266630eee1de5c43af463fe2b921451932
Modified Files
--------------
src/backend/bootstrap/bootparse.y | 2 ++
src/backend/commands/indexcmds.c | 13 +++++++++++++
src/backend/commands/tablecmds.c | 1 +
src/backend/tcop/utility.c | 1 +
src/include/commands/defrem.h | 1 +
src/test/regress/expected/triggers.out | 29 +++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql | 31 +++++++++++++++++++++++++++++++
7 files changed, 78 insertions(+)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
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-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Disallow CREATE INDEX if table is already in use in current sess
In-Reply-To: <E1dHXzQ-0007a9-KG@gemulon.postgresql.org>
References: <E1dHXzQ-0007a9-KG@gemulon.postgresql.org>
* 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