Hi,

Alvaro Herrera <alvhe...@2ndquadrant.com> writes:
>> Same for 9.2, attached. master needs yet another patch because of the
>> recent headers reorg, it seems, that's for another day though.
>
> No, just remove the RELKIND_UNCATALOGUED case in that switch.

Oh. As in the attached? :)

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support

*** a/src/bin/pg_dump/pg_dump.c
--- b/src/bin/pg_dump/pg_dump.c
***************
*** 191,197 **** static void dumpEventTrigger(Archive *fout, EventTriggerInfo *evtinfo);
  static void dumpTable(Archive *fout, TableInfo *tbinfo);
  static void dumpTableSchema(Archive *fout, TableInfo *tbinfo);
  static void dumpAttrDef(Archive *fout, AttrDefInfo *adinfo);
! static void dumpSequence(Archive *fout, TableInfo *tbinfo);
  static void dumpIndex(Archive *fout, IndxInfo *indxinfo);
  static void dumpConstraint(Archive *fout, ConstraintInfo *coninfo);
  static void dumpTableConstraintComment(Archive *fout, ConstraintInfo *coninfo);
--- 191,197 ----
  static void dumpTable(Archive *fout, TableInfo *tbinfo);
  static void dumpTableSchema(Archive *fout, TableInfo *tbinfo);
  static void dumpAttrDef(Archive *fout, AttrDefInfo *adinfo);
! static void dumpSequence(Archive *fout, TableInfo *tbinfo, bool extMember);
  static void dumpIndex(Archive *fout, IndxInfo *indxinfo);
  static void dumpConstraint(Archive *fout, ConstraintInfo *coninfo);
  static void dumpTableConstraintComment(Archive *fout, ConstraintInfo *coninfo);
***************
*** 1568,1573 **** dumpTableData(Archive *fout, TableDataInfo *tdinfo)
--- 1568,1579 ----
  	DataDumperPtr dumpFn;
  	char	   *copyStmt;
  
+ 	if (tbinfo->relkind == RELKIND_SEQUENCE)
+ 	{
+ 		dumpSequence(fout, tbinfo, true);
+ 		return;
+ 	}
+ 
  	if (!dump_inserts)
  	{
  		/* Dump/restore using COPY */
***************
*** 1640,1648 **** makeTableDataInfo(TableInfo *tbinfo, bool oids)
  	/* Skip VIEWs (no data to dump) */
  	if (tbinfo->relkind == RELKIND_VIEW)
  		return;
- 	/* Skip SEQUENCEs (handled elsewhere) */
- 	if (tbinfo->relkind == RELKIND_SEQUENCE)
- 		return;
  	/* Skip FOREIGN TABLEs (no data to dump) */
  	if (tbinfo->relkind == RELKIND_FOREIGN_TABLE)
  		return;
--- 1646,1651 ----
***************
*** 12188,12194 **** dumpTable(Archive *fout, TableInfo *tbinfo)
  		char	   *namecopy;
  
  		if (tbinfo->relkind == RELKIND_SEQUENCE)
! 			dumpSequence(fout, tbinfo);
  		else if (!dataOnly)
  			dumpTableSchema(fout, tbinfo);
  
--- 12191,12197 ----
  		char	   *namecopy;
  
  		if (tbinfo->relkind == RELKIND_SEQUENCE)
! 			dumpSequence(fout, tbinfo, false);
  		else if (!dataOnly)
  			dumpTableSchema(fout, tbinfo);
  
***************
*** 13305,13311 **** findLastBuiltinOid_V70(Archive *fout)
  }
  
  static void
! dumpSequence(Archive *fout, TableInfo *tbinfo)
  {
  	PGresult   *res;
  	char	   *startv,
--- 13308,13314 ----
  }
  
  static void
! dumpSequence(Archive *fout, TableInfo *tbinfo, bool extMember)
  {
  	PGresult   *res;
  	char	   *startv,
***************
*** 13405,13411 **** dumpSequence(Archive *fout, TableInfo *tbinfo)
  	 *
  	 * Add a 'SETVAL(seq, last_val, iscalled)' as part of a "data" dump.
  	 */
! 	if (!dataOnly)
  	{
  		/*
  		 * DROP must be fully qualified in case same name appears in
--- 13408,13414 ----
  	 *
  	 * Add a 'SETVAL(seq, last_val, iscalled)' as part of a "data" dump.
  	 */
! 	if (!extMember && !dataOnly)
  	{
  		/*
  		 * DROP must be fully qualified in case same name appears in
***************
*** 13526,13532 **** dumpSequence(Archive *fout, TableInfo *tbinfo)
  					 tbinfo->dobj.catId, 0, tbinfo->dobj.dumpId);
  	}
  
! 	if (!schemaOnly)
  	{
  		resetPQExpBuffer(query);
  		appendPQExpBuffer(query, "SELECT pg_catalog.setval(");
--- 13529,13535 ----
  					 tbinfo->dobj.catId, 0, tbinfo->dobj.dumpId);
  	}
  
! 	if (extMember || !schemaOnly)
  	{
  		resetPQExpBuffer(query);
  		appendPQExpBuffer(query, "SELECT pg_catalog.setval(");
***************
*** 14102,14112 **** getExtensionMembership(Archive *fout, ExtensionInfo extinfo[],
  				 * 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]);
  				}
  			}
  		}
--- 14105,14130 ----
  				 * the --oids setting.	This is because row filtering
  				 * conditions aren't compatible with dumping OIDs.
  				 */
!  				switch (configtbl->relkind)
!  				{
!  					case RELKIND_SEQUENCE:
!  						makeTableDataInfo(configtbl, false);
!  						break;
! 
!  					case RELKIND_RELATION:
!  					case RELKIND_VIEW:
!  						makeTableDataInfo(configtbl, false);
!  						if (configtbl->dataObj != NULL)
!  							configtbl->dataObj->filtercond =
!  								pg_strdup(extconditionarray[j]);
!  						break;
! 
!  					case RELKIND_INDEX:
!  					case RELKIND_TOASTVALUE:
!  					case RELKIND_COMPOSITE_TYPE:
!  					case RELKIND_FOREIGN_TABLE:
!  						/* not supported as an extension config dump target */
!  						break;
  				}
  			}
  		}
-- 
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