Re: pg_stat_statements and non default search_path - Mailing list pgsql-hackers

From Julien Rouhaud
Subject Re: pg_stat_statements and non default search_path
Date
Msg-id 558fb8cd-2f65-7c2d-374f-d6c5a4e3b50f@dalibo.com
Whole thread Raw
In response to Re: pg_stat_statements and non default search_path  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Responses Re: pg_stat_statements and non default search_path  (Lukas Fittl <lukas@fittl.com>)
Re: pg_stat_statements and non default search_path  (Craig Ringer <craig.ringer@2ndquadrant.com>)
List pgsql-hackers
On 16/10/2016 02:38, Jim Nasby wrote:
> On 10/10/16 12:58 AM, Julien Rouhaud wrote:
>> Unless you mean deparsing the Query instead of using raw source text?  I
>> think that would solve this issue (and also the other issue when
>> multiple queries are submitted at once, you get the normalized version
>> of all the queries multiple time), but AFAIK ruleutils.c doesn't expose
>> enough to do it (like get_query_def()), and exposing it isn't an option.
> 
> Why couldn't we expose it?
> 

I'm not really sure.  The only thread I could find on this topic didn't
get any answer:
https://www.postgresql.org/message-id/flat/5E5BB0F8-B05E-47C2-8706-F85E70A6DF7D@citusdata.com

> BTW, after thinking about it some more, I don't see how storing the
> search_path would help at all... it's not like you can do anything with
> it unless you have a huge chunk of the parser available.
> 

My use case is not really to know the fully qualified name of each
identifier, but being able to optimize a problematic query found with
pg_stat_statements.  I can already "unjumble" it automatically, but the
search_path is needed to be able to get an explain or just execute the
query.

Of course, I'd prefer that pgss can generate a fully qualified
normalized query instead of storing the search_path.

> BTW, this issue isn't limited to just tables; it affects almost every
> object identifier you can put in a query, like functions, operators,
> types, etc.

Yes, indeed.

-- 
Julien Rouhaud
http://dalibo.com - http://dalibo.org



pgsql-hackers by date:

Previous
From: Jeff Janes
Date:
Subject: Re: process type escape for log_line_prefix
Next
From: Lukas Fittl
Date:
Subject: Re: pg_stat_statements and non default search_path