Commit 410fede0 authored by Tom Lane's avatar Tom Lane

Fix two bugs in change_owner_recurse_to_sequences: it was grabbing an

overly strong lock on pg_depend, and it wasn't closing the rel when done.
The latter bug was masked by the ResourceOwner code, which is something
that should be changed.
parent 6d3f74d8
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.150 2005/03/24 00:03:22 neilc Exp $ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.151 2005/03/25 18:04:34 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -5374,7 +5374,7 @@ change_owner_recurse_to_sequences(Oid relationOid, int32 newOwnerSysId) ...@@ -5374,7 +5374,7 @@ change_owner_recurse_to_sequences(Oid relationOid, int32 newOwnerSysId)
* SERIAL sequences are those having an internal dependency on one * SERIAL sequences are those having an internal dependency on one
* of the table's columns (we don't care *which* column, exactly). * of the table's columns (we don't care *which* column, exactly).
*/ */
depRel = heap_openr(DependRelationName, RowExclusiveLock); depRel = heap_openr(DependRelationName, AccessShareLock);
ScanKeyInit(&key[0], ScanKeyInit(&key[0],
Anum_pg_depend_refclassid, Anum_pg_depend_refclassid,
...@@ -5420,6 +5420,8 @@ change_owner_recurse_to_sequences(Oid relationOid, int32 newOwnerSysId) ...@@ -5420,6 +5420,8 @@ change_owner_recurse_to_sequences(Oid relationOid, int32 newOwnerSysId)
} }
systable_endscan(scan); systable_endscan(scan);
relation_close(depRel, AccessShareLock);
} }
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment