88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.22 2008/01/01 19:45:48 momjian Exp $
11+ * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.23 2008/01/23 15:36:38 alvherre Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -1110,7 +1110,12 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
11101110
11111111deleteobjs = new_object_addresses ();
11121112
1113- sdepRel = heap_open (SharedDependRelationId ,AccessExclusiveLock );
1113+ /*
1114+ * We don't need this strong a lock here, but we'll call routines that
1115+ * acquire RowExclusiveLock. Better get that right now to avoid potential
1116+ * deadlock failures.
1117+ */
1118+ sdepRel = heap_open (SharedDependRelationId ,RowExclusiveLock );
11141119
11151120/*
11161121 * For each role, find the dependent objects and drop them using the
@@ -1224,7 +1229,7 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
12241229/* the dependency mechanism does the actual work */
12251230performMultipleDeletions (deleteobjs ,behavior );
12261231
1227- heap_close (sdepRel ,AccessExclusiveLock );
1232+ heap_close (sdepRel ,RowExclusiveLock );
12281233
12291234free_object_addresses (deleteobjs );
12301235}
@@ -1241,7 +1246,12 @@ shdepReassignOwned(List *roleids, Oid newrole)
12411246Relation sdepRel ;
12421247ListCell * cell ;
12431248
1244- sdepRel = heap_open (SharedDependRelationId ,AccessShareLock );
1249+ /*
1250+ * We don't need this strong a lock here, but we'll call routines that
1251+ * acquire RowExclusiveLock. Better get that right now to avoid potential
1252+ * deadlock problems.
1253+ */
1254+ sdepRel = heap_open (SharedDependRelationId ,RowExclusiveLock );
12451255
12461256foreach (cell ,roleids )
12471257{
@@ -1343,5 +1353,5 @@ shdepReassignOwned(List *roleids, Oid newrole)
13431353systable_endscan (scan );
13441354}
13451355
1346- heap_close (sdepRel ,AccessShareLock );
1356+ heap_close (sdepRel ,RowExclusiveLock );
13471357}