Fix bogus logic for skipping unnecessary partcollation dependencies.
authorTom Lane
Thu, 13 Dec 2018 20:11:09 +0000 (15:11 -0500)
committerTom Lane
Thu, 13 Dec 2018 20:11:24 +0000 (15:11 -0500)
The idea here is to not call recordDependencyOn for the default collation,
since we know that's pinned.  But what the code actually did was to record
the partition key's dependency on the opclass twice, instead.

Evidently introduced by sloppy coding in commit 2186b608b.  Back-patch
to v10 where that came in.

src/backend/catalog/heap.c

index bd01d54e6889f2cce608d56ef7a794c6531752ba..4f42cc15337f912a52ffe6125a087875479c877f 100644 (file)
@@ -3145,7 +3145,7 @@ StorePartitionKey(Relation rel,
 
    /* Mark this relation as dependent on a few things as follows */
    myself.classId = RelationRelationId;
-   myself.objectId = RelationGetRelid(rel);;
+   myself.objectId = RelationGetRelid(rel);
    myself.objectSubId = 0;
 
    /* Operator class and collation per key column */
@@ -3164,9 +3164,9 @@ StorePartitionKey(Relation rel,
            referenced.classId = CollationRelationId;
            referenced.objectId = partcollation[i];
            referenced.objectSubId = 0;
-       }
 
-       recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
+           recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
+       }
    }
 
    /*