Regardless of your request about silencing context messages (did not look into that): maybe SQL along these lines would do the job for you?
select id_cliente, array_to_string(ARRAY(SELECT apellido from clientes c0 WHERE c0.id_cliente = c.id_cliente), E'\n') from clientes c group by id_cliente
The functions where provided only as an example to reproduce the messages. Please disregard what they do. The actual functions on which I am working are much more complex and following the log output becomes quite cumbersome with those context messages.