From: Tom Lane <tgl@sss.pgh.pa.us>
To: potapov.dmitry@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8289: pg_stat_statements incorrect query text when executing multiple queries in a single PQexec
Date: Tue, 09 Jul 2013 15:20:56 -0400
Message-ID: <2128.1373397656@sss.pgh.pa.us> (raw)
In-Reply-To: <E1UwZTj-00075u-CB@wrigleys.postgresql.org>
References: <E1UwZTj-00075u-CB@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
potapov.dmitry@gmail.com writes:
> The testcase runs five UPDATE commands with two PQexec calls.
> First PQexec call runs: "UPDATE t1 SET a=101 WHERE id=0; UPDATE t1 SET a=102
> WHERE id=1; UPDATE t1 SET a=103 WHERE id=2"
> Second PQexec call runs: "UPDATE t2 SET b=1 where a=0; UPDATE t2 SET a=2
> WHERE b=3"
> I expect pg_stat_statements to contain three records with following query
> texts:
> 1) UPDATE t1 SET a=? WHERE id=?
> 2) UPDATE t2 SET b=? where a=?
> 3) UPDATE t2 SET a=? WHERE b=?
> Instead it contains three records with following query texts:
> 1) "UPDATE t2 SET b=1 where a=0; UPDATE t2 SET a=? WHERE b=?"
> 2) "UPDATE t1 SET a=? WHERE id=?; UPDATE t1 SET a=102 WHERE id=1; UPDATE t1
> SET a=103 WHERE id=2"
> 3) "UPDATE t2 SET b=? where a=?; UPDATE t2 SET a=2 WHERE b=3"
Yeah, that's what's going to happen, because there is no infrastructure
for determining which portion of the source text string belongs to which
query.
I suspect there are some other infelicities in pg_stat_statements'
behavior for multi-query strings, too. At least for now, that
combination is best avoided.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, potapov.dmitry@gmail.com
Subject: Re: BUG #8289: pg_stat_statements incorrect query text when executing multiple queries in a single PQexec
In-Reply-To: <2128.1373397656@sss.pgh.pa.us>
References: <E1UwZTj-00075u-CB@wrigleys.postgresql.org> <2128.1373397656@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox