I created one, but it did not look right there:
CREATE FUNCTION formatar_moeda(valor FLOAT) RETURNS VARCHAR(15) AS
$$
DECLARE
formatado VARCHAR(15);
BEGIN
SET formatado = NUMBER(valor,2);
SET formatado = REPLACE(formatado,'.','#');
SET formatado = REPLACE(formatado,',','.');
SET formatado = REPLACE(formatado,'#',',');
RETURN CONCAT('R$', formatado);
END;
$$
LANGUAGE plpgsql;