src/bin/pg_dump/pg_dump.c
static void
selectDumpableNamespace(NamespaceInfo *nsinfo, Archive *fout)
{
	/*
	 * DUMP_COMPONENT_DEFINITION typically implies a CREATE SCHEMA statement
	 * and (for --clean) a DROP SCHEMA statement.  (In the absence of
	 * DUMP_COMPONENT_DEFINITION, this value is irrelevant.)
	 */
	nsinfo->create = true;

	/*
	 * If specific tables are being dumped, do not dump any complete
	 * namespaces. If specific namespaces are being dumped, dump just those
	 * namespaces. Otherwise, dump all non-system namespaces.
	 */
	if (table_include_oids.head != NULL)
		nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_NONE;
	else if (schema_include_oids.head != NULL)
		nsinfo->dobj.dump_contains = nsinfo->dobj.dump =
			simple_oid_list_member(&schema_include_oids,
								   nsinfo->dobj.catId.oid) ?
			DUMP_COMPONENT_ALL : DUMP_COMPONENT_NONE;
	else if (fout->remoteVersion >= 90600 &&
			 strcmp(nsinfo->dobj.name, "pg_catalog") == 0)
	{
		/*
		 * In 9.6 and above, we dump out any ACLs defined in pg_catalog, if
		 * they are interesting (and not the original ACLs which were set at
		 * initdb time, see pg_init_privs).
		 */
		nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_ACL;
	}
	else if (strncmp(nsinfo->dobj.name, "pg_", 3) == 0 ||
			 strcmp(nsinfo->dobj.name, "information_schema") == 0)
	{
		/* Other system schemas don't get dumped */
		nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_NONE;
	}
	else if (strcmp(nsinfo->dobj.name, "public") == 0)
	{
		/*
		 * The public schema is a strange beast that sits in a sort of
		 * no-mans-land between being a system object and a user object.
		 * CREATE SCHEMA would fail, so its DUMP_COMPONENT_DEFINITION is just
		 * a comment and an indication of ownership.  If the owner is the
		 * default, omit that superfluous DUMP_COMPONENT_DEFINITION.  Before
		 * v15, the default owner was BOOTSTRAP_SUPERUSERID.
		 */
		nsinfo->create = false;
		nsinfo->dobj.dump = DUMP_COMPONENT_ALL;
		if (nsinfo->nspowner == ROLE_PG_DATABASE_OWNER)
			nsinfo->dobj.dump &= ~DUMP_COMPONENT_DEFINITION;
		nsinfo->dobj.dump_contains = DUMP_COMPONENT_ALL;

		/*
		 * Also, make like it has a comment even if it doesn't; this is so
		 * that we'll emit a command to drop the comment, if appropriate.
		 * (Without this, we'd not call dumpCommentExtended for it.)
		 */
		nsinfo->dobj.components |= DUMP_COMPONENT_COMMENT;
	}
	else
		nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_ALL;

	/*
	 * In any case, a namespace can be excluded by an exclusion switch
	 */
	if (nsinfo->dobj.dump_contains &&
		simple_oid_list_member(&schema_exclude_oids,
							   nsinfo->dobj.catId.oid))
		nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_NONE;

	/*
	 * If the schema belongs to an extension, allow extension membership to
	 * override the dump decision for the schema itself.  However, this does
	 * not change dump_contains, so this won't change what we do with objects
	 * within the schema.  (If they belong to the extension, they'll get
	 * suppressed by it, otherwise not.)
	 */
	(void) checkExtensionMembership(&nsinfo->dobj, fout);
}
/*
 * selectDumpableNamespace: policy-setting subroutine
 *		Mark a namespace as to be dumped or not
 */
policy-setting subroutine
Mark a namespace as to be dumped or not
policy - setting subroutine Mark a namespace as to be dumped or not
static void
selectDumpableNamespace(NamespaceInfo *nsinfo, Archive *fout)
{
	nsinfo->create = true;
	if (table_include_oids.head != NULL)
		nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_NONE;
	else if (schema_include_oids.head != NULL)
		nsinfo->dobj.dump_contains = nsinfo->dobj.dump =
			simple_oid_list_member(&schema_include_oids,
								   nsinfo->dobj.catId.oid) ?
			DUMP_COMPONENT_ALL : DUMP_COMPONENT_NONE;
	else if (fout->remoteVersion >= 90600 &&
			 strcmp(nsinfo->dobj.name, "pg_catalog") == 0)
	{
		nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_ACL;
	}
	else if (strncmp(nsinfo->dobj.name, "pg_", 3) == 0 ||
			 strcmp(nsinfo->dobj.name, "information_schema") == 0)
	{
		nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_NONE;
	}
	else if (strcmp(nsinfo->dobj.name, "public") == 0)
	{
		nsinfo->create = false;
		nsinfo->dobj.dump = DUMP_COMPONENT_ALL;
		if (nsinfo->nspowner == ROLE_PG_DATABASE_OWNER)
			nsinfo->dobj.dump &= ~DUMP_COMPONENT_DEFINITION;
		nsinfo->dobj.dump_contains = DUMP_COMPONENT_ALL;
		nsinfo->dobj.components |= DUMP_COMPONENT_COMMENT;
	}
	else
		nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_ALL;
	if (nsinfo->dobj.dump_contains &&
		simple_oid_list_member(&schema_exclude_oids,
							   nsinfo->dobj.catId.oid))
		nsinfo->dobj.dump_contains = nsinfo->dobj.dump = DUMP_COMPONENT_NONE;
	(void) checkExtensionMembership(&nsinfo->dobj, fout);
}
static void selectDumpableNamespace ( NamespaceInfo * nsinfo , Archive * fout ) { nsinfo -> create = true ; if ( table_include_oids . head != NULL ) nsinfo -> dobj . dump_contains = nsinfo -> dobj . dump = DUMP_COMPONENT_NONE ; else if ( schema_include_oids . head != NULL ) nsinfo -> dobj . dump_contains = nsinfo -> dobj . dump = simple_oid_list_member ( & schema_include_oids , nsinfo -> dobj . catId . oid ) ? DUMP_COMPONENT_ALL : DUMP_COMPONENT_NONE ; else if ( fout -> remoteVersion >= 90600 && strcmp ( nsinfo -> dobj . name , " " ) == 0 ) { nsinfo -> dobj . dump_contains = nsinfo -> dobj . dump = DUMP_COMPONENT_ACL ; } else if ( strncmp ( nsinfo -> dobj . name , " " , 3 ) == 0 || strcmp ( nsinfo -> dobj . name , " " ) == 0 ) { nsinfo -> dobj . dump_contains = nsinfo -> dobj . dump = DUMP_COMPONENT_NONE ; } else if ( strcmp ( nsinfo -> dobj . name , " " ) == 0 ) { nsinfo -> create = false ; nsinfo -> dobj . dump = DUMP_COMPONENT_ALL ; if ( nsinfo -> nspowner == ROLE_PG_DATABASE_OWNER ) nsinfo -> dobj . dump &= ~ DUMP_COMPONENT_DEFINITION ; nsinfo -> dobj . dump_contains = DUMP_COMPONENT_ALL ; nsinfo -> dobj . components |= DUMP_COMPONENT_COMMENT ; } else nsinfo -> dobj . dump_contains = nsinfo -> dobj . dump = DUMP_COMPONENT_ALL ; if ( nsinfo -> dobj . dump_contains && simple_oid_list_member ( & schema_exclude_oids , nsinfo -> dobj . catId . oid ) ) nsinfo -> dobj . dump_contains = nsinfo -> dobj . dump = DUMP_COMPONENT_NONE ; ( void ) checkExtensionMembership ( & nsinfo -> dobj , fout ) ; }
selectDumpableNamespace: policy-setting subroutine
              Mark a namespace as to be dumped or not
selectDumpableNamespace : policy - setting subroutine Mark a namespace as to be dumped or not
/*
	 * DUMP_COMPONENT_DEFINITION typically implies a CREATE SCHEMA statement
	 * and (for --clean) a DROP SCHEMA statement.  (In the absence of
	 * DUMP_COMPONENT_DEFINITION, this value is irrelevant.)
	 */ /*
	 * If specific tables are being dumped, do not dump any complete
	 * namespaces. If specific namespaces are being dumped, dump just those
	 * namespaces. Otherwise, dump all non-system namespaces.
	 */ /*
		 * In 9.6 and above, we dump out any ACLs defined in pg_catalog, if
		 * they are interesting (and not the original ACLs which were set at
		 * initdb time, see pg_init_privs).
		 */ /* Other system schemas don't get dumped */ /*
		 * The public schema is a strange beast that sits in a sort of
		 * no-mans-land between being a system object and a user object.
		 * CREATE SCHEMA would fail, so its DUMP_COMPONENT_DEFINITION is just
		 * a comment and an indication of ownership.  If the owner is the
		 * default, omit that superfluous DUMP_COMPONENT_DEFINITION.  Before
		 * v15, the default owner was BOOTSTRAP_SUPERUSERID.
		 */ /*
		 * Also, make like it has a comment even if it doesn't; this is so
		 * that we'll emit a command to drop the comment, if appropriate.
		 * (Without this, we'd not call dumpCommentExtended for it.)
		 */ /*
	 * In any case, a namespace can be excluded by an exclusion switch
	 */ /*
	 * If the schema belongs to an extension, allow extension membership to
	 * override the dump decision for the schema itself.  However, this does
	 * not change dump_contains, so this won't change what we do with objects
	 * within the schema.  (If they belong to the extension, they'll get
	 * suppressed by it, otherwise not.)
	 */