diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-07-31 20:09:10 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-07-31 20:09:10 +0000 |
commit | 09d3670df3e4593be1d2299a62d982829016b847 (patch) | |
tree | 7a62e91c1cf595d0334dd2c196d1c79835cc267b /src/backend/commands/trigger.c | |
parent | 4cd72b53b9975bab5f4ca0792cf4f54c84829404 (diff) | |
download | postgresql-09d3670df3e4593be1d2299a62d982829016b847.tar.gz postgresql-09d3670df3e4593be1d2299a62d982829016b847.zip |
Change the relation_open protocol so that we obtain lock on a relation
(table or index) before trying to open its relcache entry. This fixes
race conditions in which someone else commits a change to the relation's
catalog entries while we are in process of doing relcache load. Problems
of that ilk have been reported sporadically for years, but it was not
really practical to fix until recently --- for instance, the recent
addition of WAL-log support for in-place updates helped.
Along the way, remove pg_am.amconcurrent: all AMs are now expected to support
concurrent update.
Diffstat (limited to 'src/backend/commands/trigger.c')
-rw-r--r-- | src/backend/commands/trigger.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 158e783c575..13e7cab721b 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.204 2006/07/14 14:52:18 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.205 2006/07/31 20:09:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -36,7 +36,6 @@ #include "utils/inval.h" #include "utils/lsyscache.h" #include "utils/memutils.h" -#include "utils/relcache.h" #include "utils/syscache.h" @@ -2986,7 +2985,6 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt) while (HeapTupleIsValid(htup = systable_getnext(tgscan))) { Form_pg_trigger pg_trigger = (Form_pg_trigger) GETSTRUCT(htup); - Relation constraintRel; Oid constraintNamespaceId; /* @@ -3010,13 +3008,9 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt) pg_trigger->tgfoid == F_RI_FKEY_SETNULL_DEL || pg_trigger->tgfoid == F_RI_FKEY_SETDEFAULT_UPD || pg_trigger->tgfoid == F_RI_FKEY_SETDEFAULT_DEL) - { - constraintRel = RelationIdGetRelation(pg_trigger->tgconstrrelid); - } else { - constraintRel = RelationIdGetRelation(pg_trigger->tgrelid); - } - constraintNamespaceId = RelationGetNamespace(constraintRel); - RelationClose(constraintRel); + constraintNamespaceId = get_rel_namespace(pg_trigger->tgconstrrelid); + else + constraintNamespaceId = get_rel_namespace(pg_trigger->tgrelid); /* * If this constraint is not in the schema we're |