pgsql: Fix ALTER COLUMN TYPE to not open a relation without any lock.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix ALTER COLUMN TYPE to not open a relation without any lock.
Дата
Msg-id E1g70Tt-00044z-Ra@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix ALTER COLUMN TYPE to not open a relation without any lock.

If the column being modified is referenced by a foreign key constraint
of another table, ALTER TABLE would open the other table (to re-parse
the constraint's definition) without having first obtained a lock on it.
This was evidently intentional, but that doesn't mean it's really safe.
It's especially not safe in 9.3, which pre-dates use of MVCC scans for
catalog reads, but even in current releases it doesn't seem like a good
idea.

We know we'll need AccessExclusiveLock shortly to drop the obsoleted
constraint, so just get that a little sooner to close the hole.

Per testing with a patch that complains if we open a relation without
holding any lock on it.  I don't plan to back-patch that patch, but we
should close the holes it identifies in all supported branches.

Discussion: https://postgr.es/m/2038.1538335244@sss.pgh.pa.us

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0360c539f2a2a979a98b9bb4ae4b3d8b77ee199b

Modified Files
--------------
src/backend/commands/tablecmds.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: doc: Clarify CREATE TABLESPACE documentation
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Add assertions that we hold some relevant lock during relationo