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: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Fabien COELHO <coelho@cri.ensmp.fr>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2017-01-13T14:08:29Z
Lists: pgsql-hackers
On 13 Jan. 2017 16:35, "Kyotaro HORIGUCHI" <horiguchi.kyotaro@lab.ntt.co.jp> wrote: Hello, At Thu, 12 Jan 2017 20:08:54 +0100 (CET), Fabien COELHO <coelho@cri.ensmp.fr> wrote in <alpine.DEB.2.20.1701122004190.3788@lancre> > > About having a pointer to the initial string from RawStmt, Query & > PlannedStmt: > > > I remembered one reason why we haven't done this: it's unclear how > > we'd handle copying if we do it. If, say, Query contains a "char *" > > pointer then you'd expect copyObject() to pstrdup that string, [..., > > So] We'd need to work out a way of managing multiple Queries carrying > > references to the same source string, and it's not clear how to do > > that reasonably. > > For me it would be shared, but then it may break some memory > management hypothesis downstream. +1 to they have a pointer to the shared query string. But doing that without some measure like reference counting seems difficult.. Sounds like it'd be better as a separate change so as not to block this one. I really like what you have done Tom, though I'm about to travel so I haven't read it in full detail. Like Fabien I would've been certain that it'd be rejected if I tried it, but I sure am glad you did it.
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