dumpfix-2.patch

text/x-patch

Filename: dumpfix-2.patch
Type: text/x-patch
Part: 0
Message: Re: [GENERAL] pg_dump -s dumps data?!

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: context
File+
src/bin/pg_dump/pg_dump.c 12 0
src/bin/pg_dump/pg_dump.h 0 0
*** a/src/bin/pg_dump/pg_dump.c
--- b/src/bin/pg_dump/pg_dump.c
***************
*** 1141,1154 **** selectDumpableTable(TableInfo *tbinfo)
  							   tbinfo->dobj.catId.oid))
  		tbinfo->dobj.dump = false;
  
- 	/* If table is to be dumped, check that the data is not excluded */
- 	if (tbinfo->dobj.dump && !
- 		simple_oid_list_member(&tabledata_exclude_oids,
- 							   tbinfo->dobj.catId.oid))
- 		tbinfo->dobj.dumpdata = true;
- 	else
- 		tbinfo->dobj.dumpdata = false;
- 
  }
  
  /*
--- 1141,1146 ----
***************
*** 1599,1608 **** dumpTableData(Archive *fout, TableDataInfo *tdinfo)
  	DataDumperPtr dumpFn;
  	char	   *copyStmt;
  
- 	/* don't do anything if the data isn't wanted */
- 	if (!tbinfo->dobj.dumpdata)
- 		return;
- 
  	if (!dump_inserts)
  	{
  		/* Dump/restore using COPY */
--- 1591,1596 ----
***************
*** 1658,1663 **** getTableData(TableInfo *tblinfo, int numTables, bool oids)
--- 1646,1656 ----
  			&& no_unlogged_table_data)
  			continue;
  
+ 		/* Check that the data is not explicitly excluded */
+ 		if (simple_oid_list_member(&tabledata_exclude_oids,
+ 								   tblinfo[i].dobj.catId.oid))
+ 			continue;
+ 
  		if (tblinfo[i].dobj.dump && tblinfo[i].dataObj == NULL)
  			makeTableDataInfo(&(tblinfo[i]), oids);
  	}
***************
*** 14127,14133 **** getExtensionMembership(Archive *fout, ExtensionInfo extinfo[],
  				TableInfo  *configtbl;
  
  				configtbl = findTableByOid(atooid(extconfigarray[j]));
! 				if (configtbl && configtbl->dataObj == NULL)
  				{
  					/*
  					 * Note: config tables are dumped without OIDs regardless
--- 14120,14132 ----
  				TableInfo  *configtbl;
  
  				configtbl = findTableByOid(atooid(extconfigarray[j]));
! 
! 				if (configtbl == NULL || 
! 					simple_oid_list_member(&tabledata_exclude_oids,
! 										   configtbl->dobj.catId.oid))
! 					continue;
! 
! 				if (configtbl->dataObj == NULL)
  				{
  					/*
  					 * Note: config tables are dumped without OIDs regardless
*** a/src/bin/pg_dump/pg_dump.h
--- b/src/bin/pg_dump/pg_dump.h
***************
*** 129,135 **** typedef struct _dumpableObject
  	char	   *name;			/* object name (should never be NULL) */
  	struct _namespaceInfo *namespace;	/* containing namespace, or NULL */
  	bool		dump;			/* true if we want to dump this object */
- 	bool        dumpdata;       /* true if we want data for this object */
  	bool		ext_member;		/* true if object is member of extension */
  	DumpId	   *dependencies;	/* dumpIds of objects this one depends on */
  	int			nDeps;			/* number of valid dependencies */
--- 129,134 ----