Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Ensure that user created rows in extension tables get dumped if the table is explicit...
authorJoe Conway <mail@joeconway.com>
Fri, 26 Apr 2013 18:54:59 +0000 (11:54 -0700)
committerJoe Conway <mail@joeconway.com>
Fri, 26 Apr 2013 19:03:11 +0000 (12:03 -0700)
Backpatched to 9.1 when the extension management facility was added.

src/bin/pg_dump/pg_dump.c

index c7a5abd5e4c058106f4a84a4be7432436e37df39..6459e636d12bf6f91a16e8d425f1e1a27ef9cec1 100644 (file)
@@ -13885,10 +13885,6 @@ getExtensionMembership(ExtensionInfo extinfo[], int numExtensions)
        int         nconfigitems;
        int         nconditionitems;
 
-       /* Tables of not-to-be-dumped extensions shouldn't be dumped */
-       if (!curext->dobj.dump)
-           continue;
-
        if (parsePGArray(extconfig, &extconfigarray, &nconfigitems) &&
          parsePGArray(extcondition, &extconditionarray, &nconditionitems) &&
            nconfigitems == nconditionitems)
@@ -13898,18 +13894,51 @@ getExtensionMembership(ExtensionInfo extinfo[], int numExtensions)
            for (j = 0; j < nconfigitems; j++)
            {
                TableInfo  *configtbl;
+               Oid         configtbloid = atooid(extconfigarray[j]);
+               bool        dumpobj = curext->dobj.dump;
 
-               configtbl = findTableByOid(atooid(extconfigarray[j]));
+               configtbl = findTableByOid(configtbloid);
                if (configtbl && configtbl->dataObj == NULL)
                {
                    /*
-                    * Note: config tables are dumped without OIDs regardless
-                    * of the --oids setting.  This is because row filtering
-                    * conditions aren't compatible with dumping OIDs.
+                    * Tables of not-to-be-dumped extensions shouldn't be dumped
+                    * unless the table or its schema is explicitly included
                     */
-                   makeTableDataInfo(configtbl, false);
-                   if (strlen(extconditionarray[j]) > 0)
-                       configtbl->dataObj->filtercond = strdup(extconditionarray[j]);
+                   if (!curext->dobj.dump)
+                   {
+                       /* check table explicitly requested */
+                       if (table_include_oids.head != NULL &&
+                           simple_oid_list_member(&table_include_oids,
+                                                   configtbloid))
+                           dumpobj = true;
+
+                       /* check table's schema explicitly requested */
+                       if (configtbl->dobj.namespace->dobj.dump)
+                           dumpobj = true;
+                   }
+
+                   /* check table excluded by an exclusion switch */
+                   if (table_exclude_oids.head != NULL &&
+                       simple_oid_list_member(&table_exclude_oids,
+                                               configtbloid))
+                       dumpobj = false;
+
+                   /* check schema excluded by an exclusion switch */
+                   if (simple_oid_list_member(&schema_exclude_oids,
+                       configtbl->dobj.namespace->dobj.catId.oid))
+                       dumpobj = false;
+
+                   if (dumpobj)
+                   {
+                       /*
+                        * Note: config tables are dumped without OIDs regardless
+                        * of the --oids setting.  This is because row filtering
+                        * conditions aren't compatible with dumping OIDs.
+                        */
+                       makeTableDataInfo(configtbl, false);
+                       if (strlen(extconditionarray[j]) > 0)
+                           configtbl->dataObj->filtercond = strdup(extconditionarray[j]);
+                   }
                }
            }
        }