src/bin/pg_dump/dumputils.c
bool
buildDefaultACLCommands(const char *type, const char *nspname,
						const char *acls, const char *acldefault,
						const char *owner,
						int remoteVersion,
						PQExpBuffer sql)
{
	PQExpBuffer prefix;

	prefix = createPQExpBuffer();

	/*
	 * We incorporate the target role directly into the command, rather than
	 * playing around with SET ROLE or anything like that.  This is so that a
	 * permissions error leads to nothing happening, rather than changing
	 * default privileges for the wrong user.
	 */
	appendPQExpBuffer(prefix, "ALTER DEFAULT PRIVILEGES FOR ROLE %s ",
					  fmtId(owner));
	if (nspname)
		appendPQExpBuffer(prefix, "IN SCHEMA %s ", fmtId(nspname));

	/*
	 * There's no such thing as initprivs for a default ACL, so the base ACL
	 * is always just the object-type-specific default.
	 */
	if (!buildACLCommands("", NULL, NULL, type,
						  acls, acldefault, owner,
						  prefix->data, remoteVersion, sql))
	{
		destroyPQExpBuffer(prefix);
		return false;
	}

	destroyPQExpBuffer(prefix);

	return true;
}
/*
 * Build ALTER DEFAULT PRIVILEGES command(s) for a single pg_default_acl entry.
 *
 *	type: the object type (TABLES, FUNCTIONS, etc)
 *	nspname: schema name, or NULL for global default privileges
 *	acls: the ACL string fetched from the database
 *	acldefault: the appropriate default ACL for the object type and owner
 *	owner: username of privileges owner (will be passed through fmtId)
 *	remoteVersion: version of database
 *
 * Returns true if okay, false if could not parse the acl string.
 * The resulting commands (if any) are appended to the contents of 'sql'.
 */
Build ALTER DEFAULT PRIVILEGES command(s) for a single pg_default_acl entry.

Returns true if okay, false if could not parse the acl string.
The resulting commands (if any) are appended to the contents of 'sql'.
Build ALTER DEFAULT PRIVILEGES command ( s ) for a single pg_default_acl entry . Returns true if okay false if could not parse the acl string . The resulting commands ( if any ) are appended to the contents of ' sql ' .
bool
buildDefaultACLCommands(const char *type, const char *nspname,
						const char *acls, const char *acldefault,
						const char *owner,
						int remoteVersion,
						PQExpBuffer sql)
{
	PQExpBuffer prefix;
	prefix = createPQExpBuffer();
	appendPQExpBuffer(prefix, "ALTER DEFAULT PRIVILEGES FOR ROLE %s ",
					  fmtId(owner));
	if (nspname)
		appendPQExpBuffer(prefix, "IN SCHEMA %s ", fmtId(nspname));
	if (!buildACLCommands("", NULL, NULL, type,
						  acls, acldefault, owner,
						  prefix->data, remoteVersion, sql))
	{
		destroyPQExpBuffer(prefix);
		return false;
	}
	destroyPQExpBuffer(prefix);
	return true;
}
bool buildDefaultACLCommands ( const char * type , const char * nspname , const char * acls , const char * acldefault , const char * owner , int remoteVersion , PQExpBuffer sql ) { PQExpBuffer prefix ; prefix = createPQExpBuffer ( ) ; appendPQExpBuffer ( prefix , " " , fmtId ( owner ) ) ; if ( nspname ) appendPQExpBuffer ( prefix , " " , fmtId ( nspname ) ) ; if ( ! buildACLCommands ( " " , NULL , NULL , type , acls , acldefault , owner , prefix -> data , remoteVersion , sql ) ) { destroyPQExpBuffer ( prefix ) ; return false ; } destroyPQExpBuffer ( prefix ) ; return true ; }
Build ALTER DEFAULT PRIVILEGES command(s) for a single pg_default_acl entry.
Build ALTER DEFAULT PRIVILEGES command ( s ) for a single pg_default_acl entry .
/*
	 * We incorporate the target role directly into the command, rather than
	 * playing around with SET ROLE or anything like that.  This is so that a
	 * permissions error leads to nothing happening, rather than changing
	 * default privileges for the wrong user.
	 */ /*
	 * There's no such thing as initprivs for a default ACL, so the base ACL
	 * is always just the object-type-specific default.
	 */