Get rid of the pg_shdepend entry for a TOAST table; it's unnecessary since
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 14 May 2007 20:24:41 +0000 (20:24 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 14 May 2007 20:24:41 +0000 (20:24 +0000)
there's an indirect dependency on the owner via the parent table.  We were
already handling indexes that way, but not toast tables for some reason.
Saves a little catalog space and cuts down the verbosity of checkSharedDependencies
reports.

src/backend/catalog/heap.c
src/backend/commands/tablecmds.c

index b75753146b4c05188f17f828053625de3da320e1..8dc2eab66df8f806baf494783a1655963ff96035 100644 (file)
@@ -958,10 +958,14 @@ heap_create_with_catalog(const char *relname,
         * namespace is.  Also make a dependency link to its owner.
         *
         * For composite types, these dependencies are tracked for the pg_type
-        * entry, so we needn't record them here.  Also, skip this in bootstrap
-        * mode, since we don't make dependencies while bootstrapping.
+        * entry, so we needn't record them here.  Likewise, TOAST tables don't
+        * need a namespace dependency (they live in a pinned namespace) nor an
+        * owner dependency (they depend indirectly through the parent table).
+        * Also, skip this in bootstrap mode, since we don't make dependencies
+        * while bootstrapping.
         */
        if (relkind != RELKIND_COMPOSITE_TYPE &&
+               relkind != RELKIND_TOASTVALUE &&
                !IsBootstrapProcessingMode())
        {
                ObjectAddress myself,
index 1061b668c85a5813609bb668337bcad9febcea6a..1c89b007dce9055e2617b3231d974f9ae295c6cf 100644 (file)
@@ -5478,10 +5478,11 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing)
                /*
                 * Update owner dependency reference, if any.  A composite type has
                 * none, because it's tracked for the pg_type entry instead of here;
-                * indexes don't have their own entries either.
+                * indexes and TOAST tables don't have their own entries either.
                 */
                if (tuple_class->relkind != RELKIND_COMPOSITE_TYPE &&
-                       tuple_class->relkind != RELKIND_INDEX)
+                       tuple_class->relkind != RELKIND_INDEX &&
+                       tuple_class->relkind != RELKIND_TOASTVALUE)
                        changeDependencyOnOwner(RelationRelationId, relationOid,
                                                                        newOwnerId);