Thread: [COMMITTERS] pgsql: Disallow CREATE INDEX if table is already in use in currentsess
[COMMITTERS] pgsql: Disallow CREATE INDEX if table is already in use in currentsess
From
Tom Lane
Date:
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(+)