src/bin/psql/command.c
static char *
read_connect_arg(PsqlScanState scan_state)
{
	char	   *result;
	char		quote;

	/*
	 * Ideally we should treat the arguments as SQL identifiers.  But for
	 * backwards compatibility with 7.2 and older pg_dump files, we have to
	 * take unquoted arguments verbatim (don't downcase them). For now,
	 * double-quoted arguments may be stripped of double quotes (as if SQL
	 * identifiers).  By 7.4 or so, pg_dump files can be expected to
	 * double-quote all mixed-case \connect arguments, and then we can get rid
	 * of OT_SQLIDHACK.
	 */
	result = psql_scan_slash_option(scan_state, OT_SQLIDHACK, &quote, true);

	if (!result)
		return NULL;

	if (quote)
		return result;

	if (*result == '\0' || strcmp(result, "-") == 0)
	{
		free(result);
		return NULL;
	}

	return result;
}
/*
 * Read and interpret an argument to the \connect slash command.
 *
 * Returns a malloc'd string, or NULL if no/empty argument.
 */
Read and interpret an argument to the \connect slash command.
Returns a malloc'd string, or NULL if no/empty argument.
Read and interpret an argument to the \ connect slash command . Returns a malloc ' d string or NULL if no / empty argument .
static char *
read_connect_arg(PsqlScanState scan_state)
{
	char	   *result;
	char		quote;
	result = psql_scan_slash_option(scan_state, OT_SQLIDHACK, &quote, true);
	if (!result)
		return NULL;
	if (quote)
		return result;
	if (*result == '\0' || strcmp(result, "-") == 0)
	{
		free(result);
		return NULL;
	}
	return result;
}
static char * read_connect_arg ( PsqlScanState scan_state ) { char * result ; char quote ; result = psql_scan_slash_option ( scan_state , OT_SQLIDHACK , & quote , true ) ; if ( ! result ) return NULL ; if ( quote ) return result ; if ( * result == ' \0 ' || strcmp ( result , " " ) == 0 ) { free ( result ) ; return NULL ; } return result ; }
Read and interpret an argument to the \connect slash command.
Read and interpret an argument to the \ connect slash command .
/*
	 * Ideally we should treat the arguments as SQL identifiers.  But for
	 * backwards compatibility with 7.2 and older pg_dump files, we have to
	 * take unquoted arguments verbatim (don't downcase them). For now,
	 * double-quoted arguments may be stripped of double quotes (as if SQL
	 * identifiers).  By 7.4 or so, pg_dump files can be expected to
	 * double-quote all mixed-case \connect arguments, and then we can get rid
	 * of OT_SQLIDHACK.
	 */