Re: [HACKERS] Access to dynamic SQL in PL/pgSQL

2010-01-22 Thread Tom Lane
Simon Riggs writes: > So a "dynamic query hook". When called, the hook would give access to > the query text actually executed. Existing plugins wouldn't know about > the hook, so would never call it, so the language run time would bypass > that hook altogether. Newer versions of plugins would be

Re: [HACKERS] Access to dynamic SQL in PL/pgSQL

2010-01-22 Thread Simon Riggs
On Fri, 2010-01-22 at 11:33 -0500, Tom Lane wrote: > Simon Riggs writes: > > Anyway, there already was another way of doing this, so it shall be done > > that way instead. The beauty of a pluggable architecture is that one > > does not need approval to implement customer solutions. > > If you're

Re: [HACKERS] Access to dynamic SQL in PL/pgSQL

2010-01-22 Thread Tom Lane
Simon Riggs writes: > Anyway, there already was another way of doing this, so it shall be done > that way instead. The beauty of a pluggable architecture is that one > does not need approval to implement customer solutions. If you're talking about a bundle that you're shipping to customers, of co

Re: [HACKERS] Access to dynamic SQL in PL/pgSQL

2010-01-22 Thread Simon Riggs
On Fri, 2010-01-22 at 10:56 -0500, Tom Lane wrote: > Simon Riggs writes: > > It's not currently possible to access the SQL used in a dynamic PL/pgSQL > > statement using a PL/pgSQL plugin. > > > In src/pl/plpgsql/src/pl_exec.c's exec_stmt() we call each dynamic > > statement type, evaluate the SQ

Re: [HACKERS] Access to dynamic SQL in PL/pgSQL

2010-01-22 Thread Tom Lane
Simon Riggs writes: > It's not currently possible to access the SQL used in a dynamic PL/pgSQL > statement using a PL/pgSQL plugin. > In src/pl/plpgsql/src/pl_exec.c's exec_stmt() we call each dynamic > statement type, evaluate the SQL and free memory again before the plugin > gains control again

Re: [HACKERS] Access to dynamic SQL in PL/pgSQL

2010-01-22 Thread Simon Riggs
On Fri, 2010-01-22 at 13:39 +0200, Heikki Linnakangas wrote: > Simon Riggs wrote: > > It's not currently possible to access the SQL used in a dynamic PL/pgSQL > > statement using a PL/pgSQL plugin. > > > > In src/pl/plpgsql/src/pl_exec.c's exec_stmt() we call each dynamic > > statement type, evalu

Re: [HACKERS] Access to dynamic SQL in PL/pgSQL

2010-01-22 Thread Heikki Linnakangas
Simon Riggs wrote: > It's not currently possible to access the SQL used in a dynamic PL/pgSQL > statement using a PL/pgSQL plugin. > > In src/pl/plpgsql/src/pl_exec.c's exec_stmt() we call each dynamic > statement type, evaluate the SQL and free memory again before the plugin > gains control again

Re: [HACKERS] Access to dynamic SQL in PL/pgSQL

2010-01-22 Thread Simon Riggs
On Fri, 2010-01-22 at 11:41 +0100, Pavel Stehule wrote: > 2010/1/22 Simon Riggs : > > > > It's not currently possible to access the SQL used in a dynamic PL/pgSQL > > statement using a PL/pgSQL plugin. > > > > In src/pl/plpgsql/src/pl_exec.c's exec_stmt() we call each dynamic > > statement type, ev

Re: [HACKERS] Access to dynamic SQL in PL/pgSQL

2010-01-22 Thread Pavel Stehule
2010/1/22 Simon Riggs : > > It's not currently possible to access the SQL used in a dynamic PL/pgSQL > statement using a PL/pgSQL plugin. > > In src/pl/plpgsql/src/pl_exec.c's exec_stmt() we call each dynamic > statement type, evaluate the SQL and free memory again before the plugin > gains control

[HACKERS] Access to dynamic SQL in PL/pgSQL

2010-01-22 Thread Simon Riggs
It's not currently possible to access the SQL used in a dynamic PL/pgSQL statement using a PL/pgSQL plugin. In src/pl/plpgsql/src/pl_exec.c's exec_stmt() we call each dynamic statement type, evaluate the SQL and free memory again before the plugin gains control again. It seems simple to attach q