has_type_privilege_id_id(PG_FUNCTION_ARGS)
{
	Oid			roleid = PG_GETARG_OID(0);
	Oid			typeoid = PG_GETARG_OID(1);
	text	   *priv_type_text = PG_GETARG_TEXT_P(2);
	AclMode		mode;
	AclResult	aclresult;

	mode = convert_type_priv_string(priv_type_text);

	if (!SearchSysCacheExists1(TYPEOID, ObjectIdGetDatum(typeoid)))
		PG_RETURN_NULL();

	aclresult = pg_type_aclcheck(typeoid, roleid, mode);

	PG_RETURN_BOOL(aclresult == ACLCHECK_OK);
}
has_type_privilege_id_id(PG_FUNCTION_ARGS)
{
	Oid			roleid = PG_GETARG_OID(0);
	Oid			typeoid = PG_GETARG_OID(1);
	text	   *priv_type_text = PG_GETARG_TEXT_P(2);
	AclMode		mode;
	AclResult	aclresult;

	mode = convert_type_priv_string(priv_type_text);

	if (!SearchSysCacheExists1(TYPEOID, ObjectIdGetDatum(typeoid)))
		PG_RETURN_NULL();

	aclresult = pg_type_aclcheck(typeoid, roleid, mode);

	PG_RETURN_BOOL(aclresult == ACLCHECK_OK);
}