Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Don't record FDW user mappings as members of extensions.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 7 Aug 2018 20:32:50 +0000 (16:32 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 7 Aug 2018 20:33:08 +0000 (16:33 -0400)
CreateUserMapping has a recordDependencyOnCurrentExtension call that's
been there since extensions were introduced (very possibly my fault).
However, there's no support anywhere else for user mappings as members
of extensions, nor are they listed as a possible member object type in
the documentation.  Nor does it really seem like a good idea for user
mappings to belong to extensions when roles don't.  Hence, remove the
bogus call.

(As we saw in bug #15310, the lack of any pg_dump support for this case
ensures that any such membership record would silently disappear during
pg_upgrade.  So there's probably no need for us to do anything else
about cleaning up after this mistake.)

Discussion: https://postgr.es/m/27952.1533667213@sss.pgh.pa.us

src/backend/commands/foreigncmds.c

index cc912b2a790dc3e4530c33b4c0d03e623ad682e8..a19d6e002a7c24f71a82b93e3ea428fe1f874ba3 100644 (file)
@@ -1212,8 +1212,12 @@ CreateUserMapping(CreateUserMappingStmt *stmt)
        recordDependencyOnOwner(UserMappingRelationId, umId, useId);
    }
 
-   /* dependency on extension */
-   recordDependencyOnCurrentExtension(&myself, false);
+   /*
+    * Perhaps someday there should be a recordDependencyOnCurrentExtension
+    * call here; but since roles aren't members of extensions, it seems like
+    * user mappings shouldn't be either.  Note that the grammar and pg_dump
+    * would need to be extended too if we change this.
+    */
 
    /* Post creation hook for new user mapping */
    InvokeObjectPostCreateHook(UserMappingRelationId, umId, 0);