src/bin/pg_dump/pg_dump.c
static void
binary_upgrade_extension_member(PQExpBuffer upgrade_buffer,
								const DumpableObject *dobj,
								const char *objtype,
								const char *objname,
								const char *objnamespace)
{
	DumpableObject *extobj = NULL;
	int			i;

	if (!dobj->ext_member)
		return;

	/*
	 * Find the parent extension.  We could avoid this search if we wanted to
	 * add a link field to DumpableObject, but the space costs of that would
	 * be considerable.  We assume that member objects could only have a
	 * direct dependency on their own extension, not any others.
	 */
	for (i = 0; i < dobj->nDeps; i++)
	{
		extobj = findObjectByDumpId(dobj->dependencies[i]);
		if (extobj && extobj->objType == DO_EXTENSION)
			break;
		extobj = NULL;
	}
	if (extobj == NULL)
		fatal("could not find parent extension for %s %s",
			  objtype, objname);

	appendPQExpBufferStr(upgrade_buffer,
						 "\n-- For binary upgrade, handle extension membership the hard way\n");
	appendPQExpBuffer(upgrade_buffer, "ALTER EXTENSION %s ADD %s ",
					  fmtId(extobj->name),
					  objtype);
	if (objnamespace && *objnamespace)
		appendPQExpBuffer(upgrade_buffer, "%s.", fmtId(objnamespace));
	appendPQExpBuffer(upgrade_buffer, "%s;\n", objname);
}
/*
 * If the DumpableObject is a member of an extension, add a suitable
 * ALTER EXTENSION ADD command to the creation commands in upgrade_buffer.
 *
 * For somewhat historical reasons, objname should already be quoted,
 * but not objnamespace (if any).
 */
If the DumpableObject is a member of an extension, add a suitable
ALTER EXTENSION ADD command to the creation commands in upgrade_buffer.

For somewhat historical reasons, objname should already be quoted,
but not objnamespace (if any).
If the DumpableObject is a member of an extension add a suitable ALTER EXTENSION ADD command to the creation commands in upgrade_buffer . For somewhat historical reasons objname should already be quoted but not objnamespace ( if any ) .
static void
binary_upgrade_extension_member(PQExpBuffer upgrade_buffer,
								const DumpableObject *dobj,
								const char *objtype,
								const char *objname,
								const char *objnamespace)
{
	DumpableObject *extobj = NULL;
	int			i;
	if (!dobj->ext_member)
		return;
	for (i = 0; i < dobj->nDeps; i++)
	{
		extobj = findObjectByDumpId(dobj->dependencies[i]);
		if (extobj && extobj->objType == DO_EXTENSION)
			break;
		extobj = NULL;
	}
	if (extobj == NULL)
		fatal("could not find parent extension for %s %s",
			  objtype, objname);
	appendPQExpBufferStr(upgrade_buffer,
						 "\n-- For binary upgrade, handle extension membership the hard way\n");
	appendPQExpBuffer(upgrade_buffer, "ALTER EXTENSION %s ADD %s ",
					  fmtId(extobj->name),
					  objtype);
	if (objnamespace && *objnamespace)
		appendPQExpBuffer(upgrade_buffer, "%s.", fmtId(objnamespace));
	appendPQExpBuffer(upgrade_buffer, "%s;\n", objname);
}
static void binary_upgrade_extension_member ( PQExpBuffer upgrade_buffer , const DumpableObject * dobj , const char * objtype , const char * objname , const char * objnamespace ) { DumpableObject * extobj = NULL ; int i ; if ( ! dobj -> ext_member ) return ; for ( i = 0 ; i < dobj -> nDeps ; i ++ ) { extobj = findObjectByDumpId ( dobj -> dependencies [ i ] ) ; if ( extobj && extobj -> objType == DO_EXTENSION ) break ; extobj = NULL ; } if ( extobj == NULL ) fatal ( " " , objtype , objname ) ; appendPQExpBufferStr ( upgrade_buffer , " \n \n " ) ; appendPQExpBuffer ( upgrade_buffer , " " , fmtId ( extobj -> name ) , objtype ) ; if ( objnamespace && * objnamespace ) appendPQExpBuffer ( upgrade_buffer , " " , fmtId ( objnamespace ) ) ; appendPQExpBuffer ( upgrade_buffer , " \n " , objname ) ; }
If the DumpableObject is a member of an extension, add a suitable
 ALTER EXTENSION ADD command to the creation commands in upgrade_buffer.
If the DumpableObject is a member of an extension add a suitable ALTER EXTENSION ADD command to the creation commands in upgrade_buffer .
/*
	 * Find the parent extension.  We could avoid this search if we wanted to
	 * add a link field to DumpableObject, but the space costs of that would
	 * be considerable.  We assume that member objects could only have a
	 * direct dependency on their own extension, not any others.
	 */