[COMMITTERS] pgsql: Disallow CREATE INDEX if table is already in use in currentsess - Mailing list pgsql-committers

From Tom Lane
Subject [COMMITTERS] pgsql: Disallow CREATE INDEX if table is already in use in currentsess
Date
Msg-id E1dHXzQ-0007a9-KG@gemulon.postgresql.org
Whole thread Raw
List pgsql-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(+)


pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: [COMMITTERS] pgsql: Assorted translatable string fixes
Next
From: Tom Lane
Date:
Subject: [COMMITTERS] pgsql: #ifdef out assorted unused GEQO code.