Re: Re: [COMMITTERS] pgsql: Adjust things so that the query_string of a cached plan and the

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: [COMMITTERS] pgsql: Adjust things so that the query_string of a cached plan and the
Date: 2009-01-07 23:58:13
Message-ID: 7781.1231372693@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2009-01-08 00:13:22 pgsql: Revert current_query() change to use debug_query_string again;
Previous Message Tom Lane 2009-01-07 23:46:58 Re: Re: [COMMITTERS] pgsql: Adjust things so that the query_string of a cached plan and the

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2009-01-08 00:04:02 Re: Updates of SE-PostgreSQL 8.4devel patches (r1389)
Previous Message Alvaro Herrera 2009-01-07 23:50:04 Re: reloptions and toast tables