If I create the function below and run it outside pgAdmin, it produces the expected exception message. Inside a pgAdmin4 Query Tool window, ‘NoneType’ object has no attribute ‘query’ appears in the Messages window. Do I need to do something differently for pgAdmin to process RAISE EXCEPTION? FWIW, RAISE NOTICE works fine.
FUNCTION:
CREATE OR REPLACE FUNCTION testing()
RETURNS integer
LANGUAGE plpgsql
AS $$
BEGIN
IF 1 THEN
RAISE EXCEPTION 'internal error';
END IF;
RETURN 0;
END;
$$;
CALLED WITH:
SELECT * FROM testing()