Re: BUG: pg_stat_statements query normalization issues with combined queries
Craig Ringer <craig.ringer@2ndquadrant.com>
From: Craig Ringer <craig.ringer@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>,
Fabien COELHO <coelho@cri.ensmp.fr>, robertmhaas@gmail.com, Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Date: 2017-01-28T03:52:20Z
Lists: pgsql-hackers
On 28 Jan. 2017 02:08, "Tom Lane" <tgl@sss.pgh.pa.us> wrote: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes: > By the way the existing comment for the hook, >> * >> * We provide a function hook variable that lets loadable plugins get >> * control when ProcessUtility is called. Such a plugin would normally >> * call standard_ProcessUtility(). >> */ > This is quite a matter of course for developers. planner_hook and > other ones don't have such a comment or have a one-liner at > most. Since this hook gets a good amount of commnet, it seems > better to just remove the existing one.. Hm? I see pretty much the same wording for planner_hook: * To support loadable plugins that monitor or modify planner behavior, * we provide a hook variable that lets a plugin get control before and * after the standard planning process. The plugin would normally call * standard_planner(). I think other places have copied-and-pasted this as well. The real problem with this is it isn't a correct specification of the contract: in most cases, the right thing to do is more like "call the previous occupant of the ProcessUtility_hook, or standard_ProcessUtility if there was none." Not sure if it's worth trying to be more precise in these comments, but if we do something about it, we need to hit all the places with this wording. I'd rather leave it for the hooks documentation work that's being done elsewhere and have a README.hooks or something that discusses patterns common across hooks. Then we can just reference it. Otherwise we'll have a lot of repetitive comments. Especially once we mention that you can also ERROR out or (potentially) take no action at all.
Commits
-
Teach contrib/pg_stat_statements to handle multi-statement commands better.
- 83f2061dd037 10.0 landed
-
Change representation of statement lists, and add statement location info.
- ab1f0c822571 10.0 landed
-
Revert my bad decision of about a year ago to make PortalDefineQuery
- 1591fcbec77f 8.4.0 cited