Fix two bugs in change_owner_recurse_to_sequences: it was grabbing an
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 25 Mar 2005 18:04:47 +0000 (18:04 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 25 Mar 2005 18:04:47 +0000 (18:04 +0000)
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.

src/backend/commands/tablecmds.c

index 4be31618d80e65e4ba65c58b9eb7b4409989bd30..5303f0779869879395e66e07d20c2eabe821b466 100644 (file)
@@ -5374,7 +5374,7 @@ change_owner_recurse_to_sequences(Oid relationOid, int32 newOwnerSysId)
         * SERIAL sequences are those having an internal dependency on one
         * 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],
                        Anum_pg_depend_refclassid,
@@ -5420,6 +5420,8 @@ change_owner_recurse_to_sequences(Oid relationOid, int32 newOwnerSysId)
        }
 
        systable_endscan(scan);
+
+       relation_close(depRel, AccessShareLock);
 }
 
 /*