Re: [HACKERS] BUG: pg_stat_statements query normalization issueswith combined queries

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: [HACKERS] BUG: pg_stat_statements query normalization issueswith combined queries
Дата
Msg-id alpine.DEB.2.20.1612201149590.29821@lancre
обсуждение исходный текст
Ответ на Re: [HACKERS] BUG: pg_stat_statements query normalization issueswith combined queries  (Fabien COELHO <coelho@cri.ensmp.fr>)
Ответы Re: [HACKERS] BUG: pg_stat_statements query normalization issues withcombined queries  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Hello again pgdevs,

More investigations conclude that the information is lost by the parser.

From a ;-separated string raw_parser returns a List<Node> which are 
directly the nodes of the statements, with empty statements silently 
skipped.

The Node entry of high level statements (*Stmt) does NOT contain any
location information, only some lower level nodes have it.

A possible fix of this would be to add the query string location 
information systematically at the head of every high level *Stmt, which 
would then share both NodeTag and this information (say location and 
length). This would be a new intermediate kind of node of which all these 
statements would "inherit", say a "ParseNode" structure.

The actual location information may be filled-in at quite a high level in 
the parser, maybe around "stmtmulti" and "stmt" rules, so it would not 
necessarily be too intrusive in the overall parser grammar.

Then once the information is available, the query string may be cut where 
appropriate to only store the relevant string in pg_stat_statements or 
above.

Would this approach be acceptable, or is modifying Nodes a no-go area?

If it is acceptable, I can probably put together a patch and submit it.

If not, I suggest to update the documentation to tell that 
pg_stat_statements does not work properly with combined queries.

-- 
Fabien.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ashutosh Sharma
Дата:
Сообщение: Re: [HACKERS] pageinspect: Hash index support
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: pg_authid.rolpassword format (was Re: [HACKERS] Passwordidentifiers, protocol aging and SCRAM protocol)