Trigger stmt_beg and stmt_end for top-level statement blocks of PL/pgSQL
Trigger stmt_beg and stmt_end for top-level statement blocks of PL/pgSQL

PL/pgSQL provides a set of callbacks which can be used for extra
instrumentation of functions written in this language called at function
setup, begin and end, as well as statement begin and end.  When calling
a routine, a trigger, or an event trigger, statement callbacks are not
getting called for the top-level statement block leading to an
inconsistent handling compared to the other statements.  This
inconsistency can potentially complicate extensions doing
instrumentation work on top of PL/pgSQL, so this commit makes sure that
all statement blocks, including the top-level one, go through the
correct corresponding callbacks.

Author: Pavel Stehule
Reviewed-by: Michael Paquier
Discussion: f75c18fd8bb69f1f13c0368dd64317f2f80b6072@mail.gmail.com

adam8157/gpdb,50wu/gpdb,50wu/gpdb,lisakowen/gpdb,50wu/gpdb,lisakowen/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,adam8157/gpdb,lisakowen/gpdb,xinzweb/gpdb,adam8157/gpdb,adam8157/gpdb,greenplum-db/gpdb,adam8157/gpdb,50wu/gpdb,50wu/gpdb,50wu/gpdb,adam8157/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,adam8157/gpdb,lisakowen/gpdb,xinzweb/gpdb,xinzweb/gpdb,adam8157/gpdb,greenplum-db/gpdb,xinzweb/gpdb,xinzweb/gpdb,lisakowen/gpdb,greenplum-db/gpdb,xinzweb/gpdb,xinzweb/gpdb,lisakowen/gpdb,lisakowen/gpdb,xinzweb/gpdb,lisakowen/gpdb,greenplum-db/gpdb,50wu/gpdb,50wu/gpdb