Skip to content

Commit 359c8e4

Browse files
committed
Ensure that user created rows in extension tables get dumped if the table is explicitly requested, either with a -t/--table switch of the table itself, or by -n/--schema switch of the schema containing the extension table. Patch reviewed by Vibhor Kumar and Dimitri Fontaine.
Backpatched to 9.1 when the extension management facility was added.
1 parent 32ad1d6 commit 359c8e4

File tree

1 file changed

+40
-11
lines changed

1 file changed

+40
-11
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13885,10 +13885,6 @@ getExtensionMembership(ExtensionInfo extinfo[], int numExtensions)
1388513885
int nconfigitems;
1388613886
int nconditionitems;
1388713887

13888-
/* Tables of not-to-be-dumped extensions shouldn't be dumped */
13889-
if (!curext->dobj.dump)
13890-
continue;
13891-
1389213888
if (parsePGArray(extconfig, &extconfigarray, &nconfigitems) &&
1389313889
parsePGArray(extcondition, &extconditionarray, &nconditionitems) &&
1389413890
nconfigitems == nconditionitems)
@@ -13898,18 +13894,51 @@ getExtensionMembership(ExtensionInfo extinfo[], int numExtensions)
1389813894
for (j = 0; j < nconfigitems; j++)
1389913895
{
1390013896
TableInfo *configtbl;
13897+
Oid configtbloid = atooid(extconfigarray[j]);
13898+
bool dumpobj = curext->dobj.dump;
1390113899

13902-
configtbl = findTableByOid(atooid(extconfigarray[j]));
13900+
configtbl = findTableByOid(configtbloid);
1390313901
if (configtbl && configtbl->dataObj == NULL)
1390413902
{
1390513903
/*
13906-
* Note: config tables are dumped without OIDs regardless
13907-
* of the --oids setting. This is because row filtering
13908-
* conditions aren't compatible with dumping OIDs.
13904+
* Tables of not-to-be-dumped extensions shouldn't be dumped
13905+
* unless the table or its schema is explicitly included
1390913906
*/
13910-
makeTableDataInfo(configtbl, false);
13911-
if (strlen(extconditionarray[j]) > 0)
13912-
configtbl->dataObj->filtercond = strdup(extconditionarray[j]);
13907+
if (!curext->dobj.dump)
13908+
{
13909+
/* check table explicitly requested */
13910+
if (table_include_oids.head != NULL &&
13911+
simple_oid_list_member(&table_include_oids,
13912+
configtbloid))
13913+
dumpobj = true;
13914+
13915+
/* check table's schema explicitly requested */
13916+
if (configtbl->dobj.namespace->dobj.dump)
13917+
dumpobj = true;
13918+
}
13919+
13920+
/* check table excluded by an exclusion switch */
13921+
if (table_exclude_oids.head != NULL &&
13922+
simple_oid_list_member(&table_exclude_oids,
13923+
configtbloid))
13924+
dumpobj = false;
13925+
13926+
/* check schema excluded by an exclusion switch */
13927+
if (simple_oid_list_member(&schema_exclude_oids,
13928+
configtbl->dobj.namespace->dobj.catId.oid))
13929+
dumpobj = false;
13930+
13931+
if (dumpobj)
13932+
{
13933+
/*
13934+
* Note: config tables are dumped without OIDs regardless
13935+
* of the --oids setting. This is because row filtering
13936+
* conditions aren't compatible with dumping OIDs.
13937+
*/
13938+
makeTableDataInfo(configtbl, false);
13939+
if (strlen(extconditionarray[j]) > 0)
13940+
configtbl->dataObj->filtercond = strdup(extconditionarray[j]);
13941+
}
1391313942
}
1391413943
}
1391513944
}

0 commit comments

Comments
 (0)