On 03/14/2013 05:23 PM, Joe Conway wrote:
> On 03/13/2013 04:16 PM, Dimitri Fontaine wrote:
>> Joe Conway <m...@joeconway.com> writes:
>>> I think it should dump the user data portion, especially since that
>>> matches what pg_dump would do if you did not specify the table or schema.
>>
>> +1
>>
>> If you don't have time slots to fix that by then, I will have a look at
>> fixing that while in beta.
> 
> Here is a patch against 9.1. If there is agreement with the approach
> I'll redo for 9.2 and git head and apply.

Any objections before I commit this?

Thanks,

Joe

-- 

-- 
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 093be9e..069762f 100644
*** a/src/bin/pg_dump/pg_dump.c
--- b/src/bin/pg_dump/pg_dump.c
*************** getExtensionMembership(Archive *fout, Ex
*** 14486,14495 ****
  		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)
--- 14486,14491 ----
*************** getExtensionMembership(Archive *fout, Ex
*** 14499,14519 ****
  			for (j = 0; j < nconfigitems; j++)
  			{
  				TableInfo  *configtbl;
  
! 				configtbl = findTableByOid(atooid(extconfigarray[j]));
  				if (configtbl == NULL)
  					continue;
  
  				/*
! 				 * 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 (configtbl->dataObj != NULL)
  				{
! 					if (strlen(extconditionarray[j]) > 0)
! 						configtbl->dataObj->filtercond = pg_strdup(extconditionarray[j]);
  				}
  			}
  		}
--- 14495,14548 ----
  			for (j = 0; j < nconfigitems; j++)
  			{
  				TableInfo  *configtbl;
+ 				Oid			configtbloid = atooid(extconfigarray[j]);
+ 				bool		dumpobj = curext->dobj.dump;
  
! 				configtbl = findTableByOid(configtbloid);
  				if (configtbl == NULL)
  					continue;
  
  				/*
! 				 * Tables of not-to-be-dumped extensions shouldn't be dumped
! 				 * unless the table or its schema is explicitly included
  				 */
! 				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 (configtbl->dataObj != NULL)
! 					{
! 						if (strlen(extconditionarray[j]) > 0)
! 							configtbl->dataObj->filtercond = pg_strdup(extconditionarray[j]);
! 					}
  				}
  			}
  		}
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to