mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Revert changes to CREATE TRIGGER and ALTER TABLE ADD FOREIGN KEY locking,
per request from Tom.
This commit is contained in:
parent
8abba63859
commit
50ce8ab9fc
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$PostgreSQL: pgsql/doc/src/sgml/mvcc.sgml,v 2.48 2005/03/23 07:44:56 neilc Exp $
|
$PostgreSQL: pgsql/doc/src/sgml/mvcc.sgml,v 2.49 2005/03/24 00:03:18 neilc Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="mvcc">
|
<chapter id="mvcc">
|
||||||
@ -677,10 +677,9 @@ SELECT SUM(value) FROM mytab WHERE class = 2;
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Acquired by <command>CREATE TRIGGER</command> and
|
This lock mode is not automatically acquired on user tables by any
|
||||||
<command>ALTER TABLE ADD FOREIGN KEY</command>. This lock
|
<productname>PostgreSQL</productname> command. However it is
|
||||||
mode can also be acquired on certain system catalogs in some
|
acquired on certain system catalogs in some operations.
|
||||||
operations.
|
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.149 2005/03/23 07:44:57 neilc Exp $
|
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.150 2005/03/24 00:03:22 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -3829,13 +3829,13 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
|
|||||||
Oid constrOid;
|
Oid constrOid;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Grab a lock on the pk table, so that someone doesn't delete
|
* Grab an exclusive lock on the pk table, so that someone doesn't
|
||||||
* rows out from under us. We will eventually need to add triggers
|
* delete rows out from under us. (Although a lesser lock would do for
|
||||||
* to the table, at which point we'll need to an ExclusiveLock --
|
* that purpose, we'll need exclusive lock anyway to add triggers to
|
||||||
* therefore we grab an ExclusiveLock now to prevent possible
|
* the pk table; trying to start with a lesser lock will just create a
|
||||||
* deadlock.
|
* risk of deadlock.)
|
||||||
*/
|
*/
|
||||||
pkrel = heap_openrv(fkconstraint->pktable, ExclusiveLock);
|
pkrel = heap_openrv(fkconstraint->pktable, AccessExclusiveLock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validity and permissions checks
|
* Validity and permissions checks
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.179 2005/03/23 07:44:57 neilc Exp $
|
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.180 2005/03/24 00:03:26 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -87,14 +87,7 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
|
|||||||
ObjectAddress myself,
|
ObjectAddress myself,
|
||||||
referenced;
|
referenced;
|
||||||
|
|
||||||
/*
|
rel = heap_openrv(stmt->relation, AccessExclusiveLock);
|
||||||
* We need to prevent concurrent CREATE TRIGGER commands, as well
|
|
||||||
* as concurrent table modifications (INSERT, DELETE, UPDATE), so
|
|
||||||
* acquire an ExclusiveLock -- it should be fine to allow SELECTs
|
|
||||||
* to proceed. We could perhaps acquire ShareRowExclusiveLock, but
|
|
||||||
* there seems little gain in allowing SELECT FOR UPDATE.
|
|
||||||
*/
|
|
||||||
rel = heap_openrv(stmt->relation, ExclusiveLock);
|
|
||||||
|
|
||||||
if (stmt->constrrel != NULL)
|
if (stmt->constrrel != NULL)
|
||||||
constrrelid = RangeVarGetRelid(stmt->constrrel, false);
|
constrrelid = RangeVarGetRelid(stmt->constrrel, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user