diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-10-01 11:39:14 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-10-01 11:39:14 -0400 |
commit | db01fc97ad80e6e29dd5a2d5736cfd3e484f9a30 (patch) | |
tree | 8f1121b0b42975c3b4ceefeb425be8bfe073da4f /src/backend/utils/adt/datum.c | |
parent | 0aa1e0ef167d05a9ec66958b8784d72becf9303d (diff) | |
download | postgresql-db01fc97ad80e6e29dd5a2d5736cfd3e484f9a30.tar.gz postgresql-db01fc97ad80e6e29dd5a2d5736cfd3e484f9a30.zip |
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
Diffstat (limited to 'src/backend/utils/adt/datum.c')
0 files changed, 0 insertions, 0 deletions