diff options
author | Neil Conway <neilc@samurai.com> | 2005-03-23 07:44:57 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2005-03-23 07:44:57 +0000 |
commit | f30c76ce8de6a3d9e79367112a9287b576c9e9cd (patch) | |
tree | 9017f983db33211276afd59bb3bd3fe89e340532 /src/backend/commands/tablecmds.c | |
parent | ac323044cf6afd43f17adb11d3241737a5e40d7b (diff) | |
download | postgresql-f30c76ce8de6a3d9e79367112a9287b576c9e9cd.tar.gz postgresql-f30c76ce8de6a3d9e79367112a9287b576c9e9cd.zip |
Adjust CREATE TRIGGER and ALTER TABLE ... ADD FOREIGN KEY to acquire
ExclusiveLock rather than AccessExclusiveLock. This will allow concurrent
SELECT queries to proceed on the table. Per discussion with Andrew at
SuperNews.
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 0b11976db84..1a6c1f82625 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.148 2005/03/20 22:00:52 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.149 2005/03/23 07:44:57 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -3829,13 +3829,13 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel, Oid constrOid; /* - * Grab an exclusive lock on the pk table, so that someone doesn't - * delete rows out from under us. (Although a lesser lock would do for - * that purpose, we'll need exclusive lock anyway to add triggers to - * the pk table; trying to start with a lesser lock will just create a - * risk of deadlock.) + * Grab a lock on the pk table, so that someone doesn't delete + * rows out from under us. We will eventually need to add triggers + * to the table, at which point we'll need to an ExclusiveLock -- + * therefore we grab an ExclusiveLock now to prevent possible + * deadlock. */ - pkrel = heap_openrv(fkconstraint->pktable, AccessExclusiveLock); + pkrel = heap_openrv(fkconstraint->pktable, ExclusiveLock); /* * Validity and permissions checks |