I wrote: > The good thing about using debug_query_string is that "the current > client query" is well-defined and easy to explain. I'm worried > whether using ActivePortal isn't likely to result in a rather > implementation-dependent behavior that changes from release to release.
In fact, it *is* rather implementation-dependent. Compare what you'll get from these two functions: create function plpgsqlf() returns text as ' begin return current_query(); end' language plpgsql; create function plpgsqlf2() returns text as ' declare t text; begin for t in select current_query() loop return t; end loop; end' language plpgsql; My testing says that if we use ActivePortal then "select plpgsqlf()" returns "select plpgsqlf()" but "select plpgsqlf2()" returns " select current_query()", ie, the query associated with the implicit plpgsql cursor. I'm interested to know how you'll document that. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers