load 'plpgsql'; create extension if not exists plpgsql_check; NOTICE: extension "plpgsql_check" already exists, skipping load 'plpgsql_check'; set client_min_messages to notice; set plpgsql_check.regress_test_mode = true; set plpgsql_check.enable_tracer to on; set plpgsql_check.tracer to on; set plpgsql_check.trace_assert to on; set plpgsql_check.tracer_test_mode to true; create or replace function repro06_inner() returns void as $$ begin assert 1 = 2, 'boom'; end; $$ language plpgsql; create or replace function repro06_outer() returns void as $$ begin perform repro06_inner(); end; $$ language plpgsql; -- no outer error context frame - the loop is not entered, so this is safe select repro06_inner(); NOTICE: #0 ->> start of function repro06_inner() (oid=0, tnl=1) NOTICE: #0 PLpgSQL assert expression (1 = 2) on line 3 of repro06_inner() is false NOTICE: #0 <<- end of function repro06_inner (elapsed time=0.010 ms) aborted ERROR: boom CONTEXT: PL/pgSQL function repro06_inner() line 3 at ASSERT -- called from another function, so error_context_stack->previous is set select repro06_outer(); NOTICE: #0 ->> start of function repro06_outer() (oid=0, tnl=1) NOTICE: #2 ->> start of function repro06_inner() (oid=0, tnl=1) NOTICE: #2 context: SQL statement "SELECT repro06_inner()" NOTICE: #2 PLpgSQL assert expression (1 = 2) on line 3 of repro06_inner() is false NOTICE: #0 PL/pgSQL function repro06_outer() line 3 at PERFORM NOTICE: #2 <<- end of function repro06_inner (elapsed time=0.010 ms) aborted ERROR: boom CONTEXT: PL/pgSQL function repro06_inner() line 3 at ASSERT SQL statement "SELECT repro06_inner()" PL/pgSQL function repro06_outer() line 3 at PERFORM NOTICE: #0 <<- end of function repro06_outer (elapsed time=0.010 ms) aborted set plpgsql_check.tracer to off; set plpgsql_check.trace_assert to off;