Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b42ea79

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 5eb7c4d commit b42ea79

File tree

1 file changed

+41
-12
lines changed

1 file changed

+41
-12
lines changed

src/bin/pg_dump/pg_dump.c

+41-12
Original file line numberDiff line numberDiff line change
@@ -14621,10 +14621,6 @@ getExtensionMembership(Archive *fout, ExtensionInfo extinfo[],
1462114621
int nconfigitems;
1462214622
int nconditionitems;
1462314623

14624-
/* Tables of not-to-be-dumped extensions shouldn't be dumped */
14625-
if (!curext->dobj.dump)
14626-
continue;
14627-
1462814624
if (parsePGArray(extconfig, &extconfigarray, &nconfigitems) &&
1462914625
parsePGArray(extcondition, &extconditionarray, &nconditionitems) &&
1463014626
nconfigitems == nconditionitems)
@@ -14634,21 +14630,54 @@ getExtensionMembership(Archive *fout, ExtensionInfo extinfo[],
1463414630
for (j = 0; j < nconfigitems; j++)
1463514631
{
1463614632
TableInfo *configtbl;
14633+
Oid configtbloid = atooid(extconfigarray[j]);
14634+
bool dumpobj = curext->dobj.dump;
1463714635

14638-
configtbl = findTableByOid(atooid(extconfigarray[j]));
14636+
configtbl = findTableByOid(configtbloid);
1463914637
if (configtbl == NULL)
1464014638
continue;
1464114639

1464214640
/*
14643-
* Note: config tables are dumped without OIDs regardless of
14644-
* the --oids setting. This is because row filtering
14645-
* conditions aren't compatible with dumping OIDs.
14641+
* Tables of not-to-be-dumped extensions shouldn't be dumped
14642+
* unless the table or its schema is explicitly included
1464614643
*/
14647-
makeTableDataInfo(configtbl, false);
14648-
if (configtbl->dataObj != NULL)
14644+
if (!curext->dobj.dump)
1464914645
{
14650-
if (strlen(extconditionarray[j]) > 0)
14651-
configtbl->dataObj->filtercond = pg_strdup(extconditionarray[j]);
14646+
/* check table explicitly requested */
14647+
if (table_include_oids.head != NULL &&
14648+
simple_oid_list_member(&table_include_oids,
14649+
configtbloid))
14650+
dumpobj = true;
14651+
14652+
/* check table's schema explicitly requested */
14653+
if (configtbl->dobj.namespace->dobj.dump)
14654+
dumpobj = true;
14655+
}
14656+
14657+
/* check table excluded by an exclusion switch */
14658+
if (table_exclude_oids.head != NULL &&
14659+
simple_oid_list_member(&table_exclude_oids,
14660+
configtbloid))
14661+
dumpobj = false;
14662+
14663+
/* check schema excluded by an exclusion switch */
14664+
if (simple_oid_list_member(&schema_exclude_oids,
14665+
configtbl->dobj.namespace->dobj.catId.oid))
14666+
dumpobj = false;
14667+
14668+
if (dumpobj)
14669+
{
14670+
/*
14671+
* Note: config tables are dumped without OIDs regardless of
14672+
* the --oids setting. This is because row filtering
14673+
* conditions aren't compatible with dumping OIDs.
14674+
*/
14675+
makeTableDataInfo(configtbl, false);
14676+
if (configtbl->dataObj != NULL)
14677+
{
14678+
if (strlen(extconditionarray[j]) > 0)
14679+
configtbl->dataObj->filtercond = pg_strdup(extconditionarray[j]);
14680+
}
1465214681
}
1465314682
}
1465414683
}

0 commit comments

Comments
 (0)