]> granicus.if.org Git - postgresql/commitdiff
Suppress foreign data wrappers and foreign servers in partial dumps
authorPeter Eisentraut <peter_e@gmx.net>
Mon, 30 May 2011 20:34:34 +0000 (23:34 +0300)
committerPeter Eisentraut <peter_e@gmx.net>
Mon, 30 May 2011 20:34:34 +0000 (23:34 +0300)
This is consistent with the behavior of other global objects such as
languages and extensions.

Omitting foreign servers also omits the respective user mappings.

src/bin/pg_dump/pg_dump.c

index f925be1ffafcb7c4efdeadafc19b76d26661a3e8..3781e599c4fd5c569c69cd57560448c808e9c1a0 100644 (file)
@@ -11180,6 +11180,14 @@ dumpForeignDataWrapper(Archive *fout, FdwInfo *fdwinfo)
        if (!fdwinfo->dobj.dump || dataOnly)
                return;
 
+       /*
+        * FDWs that belong to an extension are dumped based on their "dump" field.
+        * Otherwise omit them if we are only dumping some specific object.
+        */
+       if (!fdwinfo->dobj.ext_member)
+               if (!include_everything)
+                       return;
+
        q = createPQExpBuffer();
        delq = createPQExpBuffer();
        labelq = createPQExpBuffer();
@@ -11255,7 +11263,7 @@ dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo)
        char       *fdwname;
 
        /* Skip if not to be dumped */
-       if (!srvinfo->dobj.dump || dataOnly)
+       if (!srvinfo->dobj.dump || dataOnly || !include_everything)
                return;
 
        q = createPQExpBuffer();