Exemple #1
0
static void *
find_provider(text *name,
			  PFN provider_lookup,
			  char *desc, int silent)
{
	void	   *res;
	char	   *buf;
	int			err;

	buf = downcase_truncate_identifier(VARDATA(name),
									   VARSIZE(name) - VARHDRSZ,
									   false);

	err = provider_lookup(buf, &res);

	if (err && !silent)
		ereport(ERROR,
				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
				 errmsg("Cannot use \"%s\": %s", buf, px_strerror(err))));

	pfree(buf);

	return err ? NULL : res;
}
Exemple #2
0
/*
 * Translate the input language name to lower case, and truncate if needed.
 *
 * Returns a palloc'd string
 */
char *
case_translate_language_name(const char *input)
{
	return downcase_truncate_identifier(input, strlen(input), false);
}