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

From Bruce Momjian
Subject Re: Re: [COMMITTERS] pgsql: Adjust things so that the query_string of a cached plan and the
Date
Msg-id 200901072333.n07NX5E21191@momjian.us
Whole thread Raw
In response to Re: Re: [COMMITTERS] pgsql: Adjust things so that the query_string of a cached plan and the  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Re: [COMMITTERS] pgsql: Adjust things so that the query_string of a cached plan and the  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Tom Lane wrote:
> >> The alternative I was envisioning was to have it look at the
> >> ActivePortal's query string.  However, if you prefer to define the
> >> function as returning the current client query, it's fine as-is.
> >> We should make sure the documentation explains it like that however.
> 
> > Now that you told me about ActivePortal I have used that and it seems to
> > work fine.  Patch attached and applied; documentation updated.
> 
> Well, hold on a minute.  I said that was an alternative to look at,
> not that it was necessarily better.  Can you define in words of one
> syllable which queries will be exposed this way?  I don't believe
> it's "all of them".

Well, if you call a pl function, it is going to show you the current SPI
function running rather than the user query.  Because the comment next
to the function says:
 *  Expose the current query to the user (useful in stored procedures)

I assume the portal string is better for stored procedures then
debug_query_string for current_query().

As I remember, there was lots of objection to adding current_query()
because it seemed useless, but the stored procedure logic won us over,
and I assume the portal string is a better representation for that
usage.  In fact, because the application knows the query string, you
could argue that anything that has more information than the client
query string is preferable.

But of course I might be wrong.  ;-)

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Proposal: new border setting in psql
Next
From: Andrew Dunstan
Date:
Subject: Re: parallel restore