src/bin/pg_dump/dumputils.c
void
quoteAclUserName(PQExpBuffer output, const char *input)
{
	const char *src;
	bool		safe = true;

	for (src = input; *src; src++)
	{
		/* This test had better match what putid() does */
		if (!isalnum((unsigned char) *src) && *src != '_')
		{
			safe = false;
			break;
		}
	}
	if (!safe)
		appendPQExpBufferChar(output, '"');
	for (src = input; *src; src++)
	{
		/* A double quote character in a username is encoded as "" */
		if (*src == '"')
			appendPQExpBufferChar(output, '"');
		appendPQExpBufferChar(output, *src);
	}
	if (!safe)
		appendPQExpBufferChar(output, '"');
}
/*
 * Transfer the role name at *input into the output buffer, adding
 * quoting according to the same rules as putid() in backend's acl.c.
 */
Transfer the role name at *input into the output buffer, adding
quoting according to the same rules as putid() in backend's acl.c.
Transfer the role name at * input into the output buffer adding quoting according to the same rules as putid () in backend ' s acl . c .
void
quoteAclUserName(PQExpBuffer output, const char *input)
{
	const char *src;
	bool		safe = true;
	for (src = input; *src; src++)
	{
		if (!isalnum((unsigned char) *src) && *src != '_')
		{
			safe = false;
			break;
		}
	}
	if (!safe)
		appendPQExpBufferChar(output, '"');
	for (src = input; *src; src++)
	{
		if (*src == '"')
			appendPQExpBufferChar(output, '"');
		appendPQExpBufferChar(output, *src);
	}
	if (!safe)
		appendPQExpBufferChar(output, '"');
}
void quoteAclUserName ( PQExpBuffer output , const char * input ) { const char * src ; bool safe = true ; for ( src = input ; * src ; src ++ ) { if ( ! isalnum ( ( unsigned char ) * src ) && * src != ' ' ) { safe = false ; break ; } } if ( ! safe ) appendPQExpBufferChar ( output , ' ' ) ; for ( src = input ; * src ; src ++ ) { if ( * src == ' ' ) appendPQExpBufferChar ( output , ' ' ) ; appendPQExpBufferChar ( output , * src ) ; } if ( ! safe ) appendPQExpBufferChar ( output , ' ' ) ; }
Transfer the role name at *input into the output buffer, adding
 quoting according to the same rules as putid() in backend's acl.c.
Transfer the role name at * input into the output buffer adding quoting according to the same rules as putid () in backend ' s acl . c .
/* This test had better match what putid() does */ /* A double quote character in a username is encoded as "" */