As others have pointed out, customization client_min_messagesis what you want. There are several ways to configure this setting.
SET client_min_messages = error; /.
SELECT set_config('client_min_messages', 'error', true); .
CREATE FUNCTION statement SET ; . :
CREATE FUNCTION f()
RETURNS void
SET client_min_messages = error
LANGUAGE plpgsql
AS ...