load 'plpgsql'; load 'plpgsql_check'; set plpgsql_check.mode = 'every_start'; create type _exception_type as ( state text, message text, detail text); create or replace function f1() returns void as $$ declare _exception record; begin _exception := NULL::_exception_type; exception when others then get stacked diagnostics _exception.state = RETURNED_SQLSTATE, _exception.message = MESSAGE_TEXT, _exception.detail = PG_EXCEPTION_DETAIL, _exception.hint = PG_EXCEPTION_HINT; end; $$ language plpgsql; select f1(); ERROR: record "_exception" has no field "hint" CONTEXT: PL/pgSQL function f1() line 7 at GET STACKED DIAGNOSTICS drop function f1(); drop type _exception_type; create or replace procedure proc_test() as $$ begin commit; end; $$ language plpgsql; call proc_test(); drop procedure proc_test();