I am playing with plpgsql profiling and and plpgsql plugin API. I found so callback stmt_beg and stmt_end was not called for top statement due direct call exec_stmt_block function.
Isn't better to call exec_stmt there? Then plpgsql plugin function will be called really for every plpgsql statement.
Now, the statement's hook is not called for every plpgsql_stmt_block statement. It is not big issue, but it is not consistent - and this inconsistency should be repaired inside extension. Better to be consistent and every plpgsql statement call identically.
patch attached - all regress tests passed. This patch has a effect only on plpgsql extensions.