From 59de132f9a578ae5d2909228484a61309df986e0 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Fri, 10 Feb 2012 15:22:14 -0500
Subject: [PATCH] Fix oversight in pg_dump's handling of extension
 configuration tables.

If an extension has not been selected to be dumped (perhaps because of
a --schema or --table switch), the contents of its configuration tables
surely should not get dumped either.  Per gripe from
Hubert Depesz Lubaczewski.
---
 src/bin/pg_dump/pg_dump.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 91ca9fdd895..0175ce01732 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -14179,13 +14179,18 @@ getExtensionMembership(Archive *fout, ExtensionInfo extinfo[],
 	 */
 	for (i = 0; i < numExtensions; i++)
 	{
-		char	   *extconfig = extinfo[i].extconfig;
-		char	   *extcondition = extinfo[i].extcondition;
+		ExtensionInfo *curext = &(extinfo[i]);
+		char	   *extconfig = curext->extconfig;
+		char	   *extcondition = curext->extcondition;
 		char	  **extconfigarray = NULL;
 		char	  **extconditionarray = NULL;
 		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)
-- 
GitLab